FontInstance.cpp revision c8589a6c7367d09fa756755cef0dd448c7328a71
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * bulia byak <buliabyak@users.sf.net>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstruct font_style_hash : public std::unary_function<font_style, size_t> {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstruct font_style_equal : public std::binary_function<font_style, font_style, bool> {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster bool operator()(font_style const &a, font_style const &b) const;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic const double STROKE_WIDTH_THREASHOLD = 0.01;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostersize_t font_style_hash::operator()(const font_style &x) const {
669362f1b4a40a59cfe461728c8765dbdf63159fPhill Cunnington int n = static_cast<int>(floor(100 * x.stroke_width));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( x.stroke_width >= STROKE_WIDTH_THREASHOLD ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n = x.stroke_cap * 10 + x.stroke_join + static_cast<int>(x.stroke_miter_limit * 100);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( x.nbDash > 0 ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n = static_cast<int>(floor(100 * x.dash_offset));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for (int i = 0; i < x.nbDash; i++) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n = static_cast<int>(floor(100 * x.dashes[i]));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterbool font_style_equal::operator()(const font_style &a,const font_style &b) const {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster bool same = true;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster same = ( static_cast<int>(100 * a.transform[i]) == static_cast<int>(100 * b.transform[i]) );
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster && ( a.stroke_width > STROKE_WIDTH_THREASHOLD ) == ( b.stroke_width > STROKE_WIDTH_THREASHOLD );
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( same && ( a.stroke_width > STROKE_WIDTH_THREASHOLD ) ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster && ( static_cast<int>(a.stroke_miter_limit * 100) == static_cast<int>(b.stroke_miter_limit * 100) )
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster same = ( static_cast<int>(floor(100 * a.dash_offset)) == static_cast<int>(floor(100 * b.dash_offset)) );
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster same = ( static_cast<int>(floor(100 * a.dashes[i])) == static_cast<int>(floor(100 * b.dashes[i])) );
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Outline extraction
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// Note: Freetype 2.2.1 redefined function signatures for functions to be placed in an
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// FT_Outline_Funcs structure. This is needed to keep backwards compatibility with the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// 2.1.x series.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/* *** BEGIN #if HACK *** */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// outline as returned by freetype -> livarot Path
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// see nr-type-ft2.cpp for the freetype -> artBPath on which this code is based
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic int ft2_move_to(FREETYPE_VECTOR *to, void * i_user)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // printf("m t=%f %f\n",p[0],p[1]);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic int ft2_line_to(FREETYPE_VECTOR *to, void *i_user)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // printf("l t=%f %f\n",p[0],p[1]);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic int ft2_conic_to(FREETYPE_VECTOR *control, FREETYPE_VECTOR *to, void *i_user)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Geom::Point p(to->x, to->y), c(control->x, control->y);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster user->builder.quadTo(c * user->scale, p * user->scale);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // printf("b c=%f %f t=%f %f\n",c[0],c[1],p[0],p[1]);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic int ft2_cubic_to(FREETYPE_VECTOR *control1, FREETYPE_VECTOR *control2, FREETYPE_VECTOR *to, void *i_user)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // printf("c c1=%f %f c2=%f %f t=%f %f\n",c1[0],c1[1],c2[0],c2[1],p[0],p[1]);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster //user->theP->CubicTo(p,3*(c1-user->last),3*(p-c2));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster user->builder.curveTo(c1 * user->scale, c2 * user->scale, p * user->scale);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/* *** END #if HACK *** */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster //printf("font instance born\n");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster //printf("font instance death\n");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // if ( theFace ) FT_Done_Face(theFace); // owned by pFont. don't touch
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for (int i=0;i<nbGlyph;i++) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster //char *tc=pango_font_description_to_string(descr);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster //printf("font %x %s ref'd %i\n",this,tc,refCount);
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts //char *tc=pango_font_description_to_string(descr);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster //printf("font %x %s unref'd %i\n",this,tc,refCount);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( refCount <= 0 ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster delete this;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterunsigned int font_instance::Name(gchar *str, unsigned int size)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterunsigned int font_instance::Family(gchar *str, unsigned int size)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterunsigned int font_instance::PSName(gchar *str, unsigned int size)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterunsigned int font_instance::Attribute(const gchar *key, gchar *str, unsigned int size)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster PangoFontDescription* td=pango_font_description_copy(descr);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster pango_font_description_unset_fields (td, PANGO_FONT_MASK_SIZE);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster res = (char *) FT_Get_Postscript_Name (theFace); // that's the main method, seems to always work
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (res == NULL) { // a very limited workaround, only bold, italic, and oblique will work
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster PangoStyle style=pango_font_description_get_style(descr);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster PangoWeight weight=pango_font_description_get_weight(descr);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster res=(char*)sp_font_description_get_family(descr);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster PangoStyle v=pango_font_description_get_style(descr);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if ( v == PANGO_STYLE_OBLIQUE ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster PangoWeight v=pango_font_description_get_weight(descr);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if ( v <= PANGO_WEIGHT_ULTRALIGHT ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if ( v <= PANGO_WEIGHT_LIGHT ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if ( v <= PANGO_WEIGHT_BOOK ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if ( v <= PANGO_WEIGHT_NORMAL ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if ( v <= PANGO_WEIGHT_MEDIUM ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if ( v <= PANGO_WEIGHT_SEMIBOLD ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if ( v <= PANGO_WEIGHT_BOLD ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if ( v <= PANGO_WEIGHT_ULTRABOLD ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else { // HEAVY NB: Pango defines ULTRAHEAVY = 1000 but not CSS2
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster PangoStretch v=pango_font_description_get_stretch(descr);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if ( v <= PANGO_STRETCH_CONDENSED ) {
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts } else if ( v <= PANGO_STRETCH_SEMI_CONDENSED ) {
f6d3e8d6653f14cfd38ebbbeac75a12a8536f0c7James Phillpotts } else if ( v <= PANGO_STRETCH_NORMAL ) {
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts } else if ( v <= PANGO_STRETCH_SEMI_EXPANDED ) {
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts } else if ( v <= PANGO_STRETCH_EXPANDED ) {
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts PangoVariant v=pango_font_description_get_variant(descr);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( size > 0 ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster theFace=pango_win32_font_cache_load(daddy->pangoFontCache,lf);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster XFORM identity = {1.0, 0.0, 0.0, 1.0, 0.0, 0.0};
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SetWorldTransform(daddy->hScreenDC, &identity);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SetGraphicsMode(daddy->hScreenDC, GM_COMPATIBLE);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster theFace=pango_fc_font_lock_face(PANGO_FC_FONT(pFont));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster FT_Select_Charmap(theFace,ft_encoding_unicode) && FT_Select_Charmap(theFace,ft_encoding_symbol);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SelectObject(daddy->hScreenDC,GetStockObject(SYSTEM_FONT));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster pango_win32_font_cache_unload(daddy->pangoFontCache,theFace);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster pango_fc_font_unlock_face(PANGO_FC_FONT(pFont));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostervoid font_instance::InstallFace(PangoFont* iFace)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return GetTextMetrics(daddy->hScreenDC,&tm) && tm.tmPitchAndFamily&(TMPF_TRUETYPE|TMPF_DEVICE);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster res = pango_win32_font_get_glyph_index(pFont, c);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster theFace = pango_fc_font_lock_face(PANGO_FC_FONT(pFont));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( c > 0xf0000 ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster pango_fc_font_unlock_face(PANGO_FC_FONT(pFont));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic inline Geom::Point pointfx_to_nrpoint(const POINTFX &p, double scale)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return Geom::Point(*(long*)&p.x / 65536.0 * scale,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return; // bitmap font
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( id_to_no.find(glyph_id) == id_to_no.end() ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster glyphs=(font_glyph*)realloc(glyphs,maxGlyph*sizeof(font_glyph));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n_g.bbox[0]=n_g.bbox[1]=n_g.bbox[2]=n_g.bbox[3]=0;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#ifndef GGO_UNHINTED // For compatibility with old SDKs.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster GetOutlineTextMetrics(daddy->hScreenDC, sizeof(otm), &otm);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster DWORD bufferSize=GetGlyphOutline (daddy->hScreenDC, glyph_id, GGO_GLYPH_INDEX | GGO_NATIVE | GGO_UNHINTED, &metrics, 0, NULL, &identity);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n_g.v_advance=otm.otmTextMetrics.tmHeight*scale;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // shit happened
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else if ( bufferSize == 0) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // character has no visual representation, but is valid (eg whitespace)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( GetGlyphOutline (daddy->hScreenDC, glyph_id, GGO_GLYPH_INDEX | GGO_NATIVE | GGO_UNHINTED, &metrics, bufferSize, buffer, &identity) <= 0 ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // shit happened
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Platform SDK is rubbish, read KB87115 instead
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster TTPOLYGONHEADER const *polyHeader=(TTPOLYGONHEADER const *)(buffer+polyOffset);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (polyOffset+polyHeader->cb > bufferSize) break;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster path_builder.moveTo(pointfx_to_nrpoint(polyHeader->pfxStart, scale));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster DWORD curveOffset=polyOffset+sizeof(TTPOLYGONHEADER);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster while ( curveOffset < polyOffset+polyHeader->cb ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster TTPOLYCURVE const *polyCurve=(TTPOLYCURVE const *)(buffer+curveOffset);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster while ( p != endp )
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster path_builder.lineTo(pointfx_to_nrpoint(*p++, scale));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // The list of points specifies one or more control points and ends with the end point.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // The intermediate points (on the curve) are the points between the control points.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Geom::Point this_control = pointfx_to_nrpoint(*p++, scale);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster while ( p+1 != endp ) { // Process all "midpoints" (all points except the last)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Geom::Point new_control = pointfx_to_nrpoint(*p++, scale);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster path_builder.quadTo(this_control, (new_control+this_control)/2);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Geom::Point end = pointfx_to_nrpoint(*p++, scale);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster while ( p != endp ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster path_builder.curveTo(pointfx_to_nrpoint(p[0], scale),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster curveOffset += sizeof(TTPOLYCURVE)+sizeof(POINTFX)*(polyCurve->cpfx-1);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (FT_Load_Glyph (theFace, glyph_id, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // shit happened
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n_g.h_advance=((double)theFace->glyph->metrics.horiAdvance)/((double)theFace->units_per_EM);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n_g.h_width=((double)theFace->glyph->metrics.width)/((double)theFace->units_per_EM);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n_g.h_width=n_g.h_advance=((double)(theFace->bbox.xMax-theFace->bbox.xMin))/((double)theFace->units_per_EM);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n_g.v_advance=((double)theFace->glyph->metrics.vertAdvance)/((double)theFace->units_per_EM);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n_g.v_width=((double)theFace->glyph->metrics.height)/((double)theFace->units_per_EM);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n_g.v_width=n_g.v_advance=((double)theFace->height)/((double)theFace->units_per_EM);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( theFace->glyph->format == ft_glyph_format_outline ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster FT2GeomData user(path_builder, 1.0/((double)theFace->units_per_EM));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster FT_Outline_Decompose (&theFace->glyph->outline, &ft2_outline_funcs, &user);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // close all paths
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for (Geom::PathVector::iterator i = pv.begin(); i != pv.end(); ++i) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Geom::OptRect bounds = bounds_exact(*n_g.pathvector);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterbool font_instance::FontMetrics(double &ascent,double &descent,double &leading)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( !GetOutlineTextMetrics(daddy->hScreenDC,sizeof(otm),&otm) ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster //otmSubscriptSize, otmSubscriptOffset, otmSuperscriptSize, otmSuperscriptOffset,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false; // bitmap font
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ascent=fabs(((double)theFace->ascender)/((double)theFace->units_per_EM));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster descent=fabs(((double)theFace->descender)/((double)theFace->units_per_EM));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster leading=fabs(((double)theFace->height)/((double)theFace->units_per_EM));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return true;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster double &underline_position, double &underline_thickness,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster double &linethrough_position, double &linethrough_thickness
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( !GetOutlineTextMetrics(daddy->hScreenDC,sizeof(otm),&otm) ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster underline_position = fabs(otm.otmUnderscorePosition *scale);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster underline_thickness = fabs(otm.otmUnderscoreSize *scale);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster linethrough_position = fabs(otm.otmStrikeoutPosition *scale);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster linethrough_thickness = fabs(otm.otmStrikeoutSize *scale);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false; // bitmap font
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster underline_position = fabs(((double)theFace->underline_position )/((double)theFace->units_per_EM));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster underline_thickness = fabs(((double)theFace->underline_thickness)/((double)theFace->units_per_EM));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // there is no specific linethrough information, mock it up from other font fields
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster linethrough_position = fabs(((double)theFace->ascender / 3.0 )/((double)theFace->units_per_EM));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster linethrough_thickness = fabs(((double)theFace->underline_thickness)/((double)theFace->units_per_EM));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return true;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterbool font_instance::FontSlope(double &run, double &rise)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( !GetOutlineTextMetrics(daddy->hScreenDC,sizeof(otm),&otm) ) return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false; // bitmap font
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster TT_HoriHeader *hhea = (TT_HoriHeader*)FT_Get_Sfnt_Table(theFace, ft_sfnt_hhea);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return true;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( id_to_no.find(glyph_id) == id_to_no.end() ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( id_to_no.find(glyph_id) == id_to_no.end() ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // didn't load
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( no < 0 ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Geom::Point rmin(glyphs[no].bbox[0],glyphs[no].bbox[1]);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Geom::Point rmax(glyphs[no].bbox[2],glyphs[no].bbox[3]);
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterGeom::PathVector* font_instance::PathVector(int glyph_id)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( id_to_no.find(glyph_id) == id_to_no.end() ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( id_to_no.find(glyph_id) == id_to_no.end() ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // didn't load
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterdouble font_instance::Advance(int glyph_id,bool vertical)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( id_to_no.find(glyph_id) == id_to_no.end() ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( id_to_no.find(glyph_id) == id_to_no.end() ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // didn't load
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( no >= 0 ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Local Variables:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster c-file-style:"stroustrup"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster indent-tabs-mode:nil
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster fill-column:99
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :