summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Williams <gww@silcom.com>2003-01-22 19:55:04 +0000
committerGeorge Williams <gww@silcom.com>2003-01-22 19:55:04 +0000
commit06da06f93cc270090edaa7b4038d6c7d43609082 (patch)
tree47ed5e46eef8e1e97f21a7554354115a3f4d8336
parentf5753e1e8e9152b9b9663225ffbe41f7592039bf (diff)
Oops. We weren't handling multiple pointsizes with multiple styles properly.
-rw-r--r--ufond.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/ufond.c b/ufond.c
index dece297..8bdc3c2 100644
--- a/ufond.c
+++ b/ufond.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 by George Williams */
+/* Copyright (C) 2001-2003 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -300,7 +300,7 @@ static void putpsstring(FILE *res,char *fontname) {
static uint32 FamilyToFOND(FILE *res,Family *fam) {
uint32 rlenpos = ftell(res), widoffpos, widoffloc, kernloc, styleloc, glyphloc, end;
- int i,j,cnt, scnt, strcnt, pscnt, maxw;
+ int i,j,cnt, scnt, strcnt, pscnt, maxw, size;
Face *face, *test;
int exact, badmatch;
/* Fonds are generally marked system heap and sometimes purgeable (resource flags) */
@@ -345,17 +345,24 @@ static uint32 FamilyToFOND(FILE *res,Family *fam) {
++scnt;
}
putshort(cnt-1,res); /* Number of faces */
+ /* This list is ordered by size and then by style */
for ( i=cnt=0; i<96; ++i ) if ( fam->ttffaces[i]!=NULL ) {
putshort(0,res); /* it's scaleable */
putshort(i,res); /* style */
fam->ttffaces[i]->id = fam->id + cnt++;
putshort(fam->ttffaces[i]->id,res);
}
- for ( i=0; i<96; ++i ) for ( face=fam->faces[i]; face!=NULL; face=face->next ) {
- putshort(face->size,res);
- putshort(i,res); /* style */
- face->id = fam->id + cnt++;
- putshort(face->id,res); /* make up a unique ID */
+ for ( i=0; i<96; ++i ) /* I depend on this ordering */
+ for ( face=fam->faces[i]; face!=NULL; face=face->next )
+ face->id = fam->id + cnt++;
+ for ( size=1; size<256; ++size ) {
+ for ( i=0; i<96; ++i ) {
+ for ( face=fam->faces[i]; face!=NULL; face=face->next ) if ( face->size==size ) {
+ putshort(face->size,res);
+ putshort(i,res); /* style */
+ putshort(face->id,res); /* make up a unique ID */
+ }
+ }
}
/* offset table */
@@ -392,6 +399,8 @@ static uint32 FamilyToFOND(FILE *res,Family *fam) {
putshort(i,res); /* style */
for ( j=0; j<256; ++j )
putshort(face->metrics[j],res);
+ putshort(1<<12,res); /* Seem to be two extra glyphs. default is one */
+ putshort(1<<12,res); /* 1 em is default size */
}
kernloc = 0;