double quality;
} gfxdrawinfo_t;
-static int ft_move_to(FT_Vector* _to, void* user)
+static int ft_move_to(const FT_Vector* _to, void* user)
{
gfxdrawinfo_t* info = (gfxdrawinfo_t*)user;
gfxdrawer_t* draw = info->draw;
draw->moveTo(draw, x,y);
return 0;
}
-static int ft_line_to(FT_Vector* _to, void* user)
+static int ft_line_to(const FT_Vector* _to, void* user)
{
gfxdrawinfo_t* info = (gfxdrawinfo_t*)user;
gfxdrawer_t* draw = info->draw;
draw->lineTo(draw, x,y);
return 0;
}
-static int ft_cubic_to(FT_Vector* _c1, FT_Vector* _c2, FT_Vector* _to, void* user)
+static int ft_cubic_to(const FT_Vector* _c1, const FT_Vector* _c2, const FT_Vector* _to, void* user)
{
gfxdrawinfo_t* info = (gfxdrawinfo_t*)user;
gfxdrawer_t* draw = info->draw;
gfxdraw_cubicTo(draw, c1x, c1y, c2x, c2y, tox, toy, info->quality);
return 0;
}
-static int ft_conic_to(FT_Vector* _c, FT_Vector* _to, void* user)
+static int ft_conic_to(const FT_Vector* _c, const FT_Vector* _to, void* user)
{
gfxdrawinfo_t* info = (gfxdrawinfo_t*)user;
gfxdrawer_t* draw = info->draw;
{
gfxline_t*line;
if(g->name) {
- free(g->name); g->name = 0;
+ free((void*)g->name); g->name = 0;
}
gfxline_free(g->line);g->line = 0;
}
fontname = FT_Get_Postscript_Name(face);
+ /*for(t=0;t<face->num_charmaps;t++) {
+ printf("possible encoding: %c%c%c%c (%d of %d)\n",
+ (face->charmaps[t]->encoding >> 24)&255,
+ (face->charmaps[t]->encoding >> 16)&255,
+ (face->charmaps[t]->encoding >> 8)&255,
+ (face->charmaps[t]->encoding >> 0)&255,
+ t+1, face->num_charmaps
+ );
+ }*/
+
while(1)
{
charcode = FT_Get_First_Char(face, &gindex);
+
+ /*if(face->charmap) {
+ printf("ENCODING: %c%c%c%c (%d of %d)\n",
+ (face->charmap->encoding >> 24)&255,
+ (face->charmap->encoding >> 16)&255,
+ (face->charmap->encoding >> 8)&255,
+ (face->charmap->encoding >> 0)&255,
+ charmap, face->num_charmaps
+ );
+ } else {
+ printf("ENCODING: NONE (%d of %d)\n",
+ charmap, face->num_charmaps
+ );
+ }*/
+
while(gindex != 0)
{
if(gindex >= 0 && gindex<face->num_glyphs) {
TODO: find a way to convert the encoding to unicode
*/
if(font->max_unicode == 0 && charmap < face->num_charmaps-1 &&
- face->charmaps[charmap+1]->encoding != 0x41444243 /* custom */)
+ face->charmaps[charmap+1]->encoding != 0x41444243 /* custom */
+ && face->charmaps[charmap+1]->encoding != 0x61726d6e /* armn */
+ )
{
charmap++;
FT_Set_Charmap(face, face->charmaps[charmap]);
} else
break;
}
-
/* TODO: if isunicode is 1, we now need to permutate the character
order so that each character is at it's encoding position */
hasname = 1;
}
}
- if(has_had_errors && (isunicode && !glyph2unicode[t]) && !hasname) {
+
+#if 0 // some cantonese pdfs fail to work if this is activated
+
+ if(has_had_errors && (isunicode && !glyph2unicode[t]) && !hasname && t>=256) {
/* some freetype versions crash or corrupt memory if we try to load
characters (without unicode index or name) above 256 for some fonts.
So skip those characters once the first error occured */
omit = 1;
}
+#endif
+
if(!omit) {
error = FT_Load_Glyph(face, t, FT_LOAD_NO_BITMAP);
if(error) {
FT_Done_Glyph(glyph);
omit = 4;
} else {
- font->glyphs[font->num_glyphs].advance = (glyph->advance.x*20)/65536;
+ font->glyphs[font->num_glyphs].advance = glyph->advance.x/65536;
font->glyphs[font->num_glyphs].line = (gfxline_t*)draw.result(&draw);
}
l = font->glyphs[font->num_glyphs].line;
*/
font->glyphs[font->num_glyphs].unicode = 0;
if(font->glyphs[font->num_glyphs].name) {
- free(font->glyphs[font->num_glyphs].name);
+ free((void*)font->glyphs[font->num_glyphs].name);
font->glyphs[font->num_glyphs].name = 0;
}
FT_Done_Glyph(glyph);