summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Williams <gww@silcom.com>2002-10-17 20:48:35 +0000
committerGeorge Williams <gww@silcom.com>2002-10-17 20:48:35 +0000
commit156d4b72e6d6d3180c06d7ae442639149189b08a (patch)
tree31230bf34becfea2fd19e7b32d7b20c906e5600b
parent1ab98b737732981c2c991fcc7f6352f770f5b838 (diff)
Greg Ford tells me I need a glyph encoding sub-table in FONDs with postscript
fonts.
-rw-r--r--showfond.c16
-rw-r--r--ufond.c13
-rw-r--r--ufondpfb.c2
3 files changed, 27 insertions, 4 deletions
diff --git a/showfond.c b/showfond.c
index 1da45ba..afbce49 100644
--- a/showfond.c
+++ b/showfond.c
@@ -70,7 +70,7 @@ static FOND *BuildFondList(FILE *f,long rlistpos,int subcnt,long rdata_pos,
int ch1, ch2;
int i, j, k, l, ch, rlen, cnt;
FOND *head=NULL, *cur;
- long widoff, kernoff, styleoff, bboff, offsetstart;
+ long widoff, kernoff, styleoff, bboff, offsetstart, glyphenc;
fseek(f,rlistpos,SEEK_SET);
for ( i=0; i<subcnt; ++i ) {
@@ -220,7 +220,7 @@ static FOND *BuildFondList(FILE *f,long rlistpos,int subcnt,long rdata_pos,
if ( class&0x80 ) printf( " 0x80 No auto-condense\n" );
if ( class&0x100 ) printf( " 0x100 No auto-expand\n" );
if ( class&0x200 ) printf( " 0x200 Needs some other encoding scheme\n" );
- printf( " Glyph encoding offset: %d\n", getlong(f)); /* offset from start of table */
+ printf( " Glyph encoding offset: %d\n", glyphenc = getlong(f)); /* offset from start of table */
/* reserved = */ getlong(f);
/* 48 (byte) indeces into the name table */
printf( "Plain index is: %d\n", getc(f));
@@ -258,6 +258,18 @@ static FOND *BuildFondList(FILE *f,long rlistpos,int subcnt,long rdata_pos,
/* then load that string, the bytes in the string tell you what */
/* other strings to concatenate to the base font name to get the */
/* PS fontname for this style */
+ if ( glyphenc!=0 ) {
+ fseek(f,styleoff+glyphenc,SEEK_SET);
+ printf( "Postscript glyph-name cnt: %d\n", cnt = getushort(f));
+ for ( l=1; l<=cnt; ++l ) {
+ printf( " Map encoding 0x%02x to '", getc(f));
+ k = getc(f);
+ for ( j=0; j<k; ++j)
+ putchar(getc(f));
+ putchar('\'');
+ putchar('\n');
+ }
+ }
}
fseek(f,here,SEEK_SET);
}
diff --git a/ufond.c b/ufond.c
index 511e9f9..6e8b025 100644
--- a/ufond.c
+++ b/ufond.c
@@ -299,7 +299,7 @@ static void putpsstring(FILE *res,char *fontname) {
}
static uint32 FamilyToFOND(FILE *res,Family *fam) {
- uint32 rlenpos = ftell(res), widoffpos, widoffloc, kernloc, styleloc, end;
+ uint32 rlenpos = ftell(res), widoffpos, widoffloc, kernloc, styleloc, glyphloc, end;
int i,j,cnt, scnt, strcnt, pscnt, maxw;
Face *face, *test;
int exact, badmatch;
@@ -441,6 +441,11 @@ static uint32 FamilyToFOND(FILE *res,Family *fam) {
if ( strcmp(family,fam->psfaces[i]->fontname)!=0 )
putpsstring(res,fam->psfaces[i]->fontname+strlen(family));
}
+ /* Greg: record offset for glyph encoding table */
+ /* We assume that the bitmap and postscript fonts are encoded similarly */
+ /* and so a null vector will do. */
+ glyphloc = ftell( res );
+ putshort(0, res); /* Greg: an empty Glyph encoding table */
}
end = ftell(res);
@@ -449,6 +454,12 @@ static uint32 FamilyToFOND(FILE *res,Family *fam) {
putlong(kernloc!=0?kernloc-rlenpos-4:0,res); /* Fill in kern offset */
putlong(styleloc!=0?styleloc-rlenpos-4:0,res); /* Fill in style offset */
+ /* Greg: go back and add the glyph encoding table offset */
+ if (styleloc && glyphloc) {
+ fseek(res, styleloc + 2, SEEK_SET);
+ putlong(glyphloc-styleloc, res);
+ }
+
fseek(res,rlenpos,SEEK_SET);
putlong(end-rlenpos-4,res); /* resource length */
fseek(res,end,SEEK_SET);
diff --git a/ufondpfb.c b/ufondpfb.c
index 10adb51..660c21f 100644
--- a/ufondpfb.c
+++ b/ufondpfb.c
@@ -41,7 +41,7 @@ static long getpfblong(FILE *f) {
int ch4 = getc(f);
if ( ch4==EOF )
return( EOF );
-return( ch1|(ch2<<8)|(ch3<<16)|(ch4<<24) );
+return( ch4|(ch3<<8)|(ch2<<16)|(ch1<<24) );
}
int PSGetNames(Face *face) {