X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fgfxfont.c;h=45a44ca9afd455d6a981ea136ffb31343fcb1727;hb=191439ab6ffe1cad91825ae84286bf720370f863;hp=1c6bf5f4fbc1866eb368f109ba303436dc5fd17d;hpb=b8c1c46e31ee01ac4757a95611e26ce72336b5f0;p=swftools.git diff --git a/lib/gfxfont.c b/lib/gfxfont.c index 1c6bf5f..45a44ca 100644 --- a/lib/gfxfont.c +++ b/lib/gfxfont.c @@ -136,7 +136,7 @@ static void glyph_clear(gfxglyph_t*g) static int errorno = 0; -gfxfont_t* gfxfont_load(char*filename, double quality) +gfxfont_t* gfxfont_load(char*id, char*filename, double quality) { FT_Face face; FT_Error error; @@ -164,7 +164,7 @@ gfxfont_t* gfxfont_load(char*filename, double quality) FT_Set_Pixel_Sizes (face, 16*loadfont_scale, 16*loadfont_scale); if(error) { - fprintf(stderr, "Couldn't load file %s- not a TTF file?\n", filename); + fprintf(stderr, "Couldn't load file %s- not a TTF file? (error=%02x)\n", filename, error); return 0; } if(face->num_glyphs <= 0) { @@ -179,6 +179,7 @@ gfxfont_t* gfxfont_load(char*filename, double quality) //font->leading = font->layout->ascent + font->layout->descent; //font->encoding = FONT_ENCODING_UNICODE; font->max_unicode = 0; + font->id = strdup(id); font->glyphs = rfx_calloc(face->num_glyphs*sizeof(gfxglyph_t)); glyph2unicode = rfx_calloc(face->num_glyphs*sizeof(int)); @@ -211,11 +212,13 @@ gfxfont_t* gfxfont_load(char*filename, double quality) the encoding is no longer unicode. TODO: find a way to convert the encoding to unicode */ - if(font->max_unicode == 0 && charmap < face->num_charmaps - 1) { + if(font->max_unicode == 0 && charmap < face->num_charmaps-1 && + face->charmaps[charmap+1]->encoding != 0x41444243 /* custom */) + { charmap++; FT_Set_Charmap(face, face->charmaps[charmap]); isunicode = 0; - } else + } else break; }