static void glpath( int glyphno, GLYPH *glyf_list ) { FT_Outline *ol; curg = &glyf_list[glyphno]; if( FT_Load_Glyph(face, glyphno, FT_LOAD_NO_BITMAP|FT_LOAD_NO_SCALE|FT_LOAD_NO_HINTING) || face->glyph->format != ft_glyph_format_outline ) { fprintf(stderr, "Can't load glyph %s, skipped\n", curg->name); return; } ol = &face->glyph->outline; lastx = 0.0; lasty = 0.0; if( FT_Outline_Decompose(ol, &ft_outl_funcs, NULL) ) { fprintf(stderr, "Can't decompose outline of glyph %s, skipped\n", curg->name); return; } /* FreeType does not do explicit closepath() */ if(curg->lastentry) { g_closepath(curg); } if(ol->flags & ft_outline_reverse_fill) { assertpath(curg->entries, __FILE__, __LINE__, curg->name); reversepaths(curg); } }
static void readglyphs( GLYPH *glyph_list ) { int i; GLYPH *g; if(got_glyphs) return; /* pass them to handle_glyphs() through statics */ glyphs = glyph_list; curgl = 2; /* skip the empty glyph and .notdef */ /* initialize the empty glyph and .notdef */ for(i=0; i<2; i++) { g = &glyphs[i]; g->lsb = 0; g->width = fmet.bbox[2]; g->xMin = 0; g->yMin = 0; } g = &glyphs[0]; g->name = ".notdef"; g->xMax = fmet.bbox[2]*4/5; g->yMax = fmet.bbox[3]*4/5; g->entries = g->path = g->lastentry = 0; /* make it look as a black square */ fg_rmoveto(g, 0.0, 0.0); fg_rlineto(g, 0.0, (double)g->yMax); fg_rlineto(g, (double)g->xMax, (double)g->yMax); fg_rlineto(g, (double)g->xMax, 0.0); fg_rlineto(g, 0.0, 0.0); g_closepath(g); glpaths[0] = g->entries; g->entries = 0; g->ttf_pathlen = 4; g = &glyphs[1]; g->name = ".null"; g->xMax = g->yMax = 0; g->ttf_pathlen = 0; if(readfile(bdf_file, handle_glyphs) < 0) { fprintf(stderr, "**** file does not contain the ENDFONT line\n"); exit(1); } got_glyphs = 1; }
static int outl_moveto( FT_Vector *to, void *unused ) { double tox, toy; tox = fscale((double)to->x); toy = fscale((double)to->y); /* FreeType does not do explicit closepath() */ if(curg->lastentry) { g_closepath(curg); } fg_rmoveto(curg, tox, toy); lastx = tox; lasty = toy; return 0; }