freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype][wl/sbix] [truetype] Fix 'sbix' table handling.


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][wl/sbix] [truetype] Fix 'sbix' table handling.
Date: Mon, 07 Feb 2022 21:08:39 +0000

Werner Lemberg pushed to branch wl/sbix at FreeType / FreeType

Commits:

3 changed files:

Changes:

  • src/sfnt/sfobjs.c
    ... ... @@ -851,12 +851,6 @@
    851 851
         is_apple_sbit = 0;
    
    852 852
         is_apple_sbix = !face->goto_table( face, TTAG_sbix, stream, 0 );
    
    853 853
     
    
    854
    -    /* Apple 'sbix' color bitmaps are rendered scaled and then the 'glyf'
    
    855
    -     * outline rendered on top.  We don't support that yet, so just ignore
    
    856
    -     * the 'glyf' outline and advertise it as a bitmap-only font. */
    
    857
    -    if ( is_apple_sbix )
    
    858
    -      has_outline = FALSE;
    
    859
    -
    
    860 854
         /* if this font doesn't contain outlines, we try to load */
    
    861 855
         /* a `bhed' table                                        */
    
    862 856
         if ( !has_outline && sfnt->load_bhed )
    

  • src/sfnt/ttsbit.c
    ... ... @@ -1587,7 +1587,7 @@
    1587 1587
           tt_face_get_metrics( face, FALSE, glyph_index, &abearing, &aadvance );
    
    1588 1588
     
    
    1589 1589
           metrics->horiBearingX = (FT_Short)originOffsetX;
    
    1590
    -      metrics->horiBearingY = (FT_Short)( -originOffsetY + metrics->height );
    
    1590
    +      metrics->horiBearingY = (FT_Short)( originOffsetY + metrics->height );
    
    1591 1591
           metrics->horiAdvance  = (FT_UShort)( aadvance *
    
    1592 1592
                                                face->root.size->metrics.x_ppem /
    
    1593 1593
                                                face->header.Units_Per_EM );
    

  • src/truetype/ttgload.c
    ... ... @@ -2899,6 +2899,9 @@
    2899 2899
           {
    
    2900 2900
             if ( FT_IS_SCALABLE( glyph->face ) )
    
    2901 2901
             {
    
    2902
    +          TT_Face  face = (TT_Face)glyph->face;
    
    2903
    +
    
    2904
    +
    
    2902 2905
               /* for the bbox we need the header only */
    
    2903 2906
               (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );
    
    2904 2907
               (void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );
    
    ... ... @@ -2906,6 +2909,27 @@
    2906 2909
               glyph->linearHoriAdvance = loader.linear;
    
    2907 2910
               glyph->linearVertAdvance = loader.vadvance;
    
    2908 2911
     
    
    2912
    +          /* bitmaps from the `sbix' table need special treatment:  */
    
    2913
    +          /* if there is a glyph contour, the bitmap origin must be */
    
    2914
    +          /* shifted to be relative to the lower left corner of the */
    
    2915
    +          /* glyph bounding box, also taking the left-side bearing  */
    
    2916
    +          /* (or top bearing) into account                          */
    
    2917
    +          if ( face->sbit_table_type == TT_SBIT_TABLE_TYPE_SBIX &&
    
    2918
    +               loader.n_contours > 0                            )
    
    2919
    +          {
    
    2920
    +            FT_Int  bitmap_left = loader.bbox.xMin;
    
    2921
    +            FT_Int  bitmap_top  = loader.bbox.yMin;
    
    2922
    +
    
    2923
    +
    
    2924
    +            if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
    
    2925
    +              bitmap_top += loader.top_bearing;
    
    2926
    +            else
    
    2927
    +              bitmap_left += loader.left_bearing;
    
    2928
    +
    
    2929
    +            glyph->bitmap_left += FT_MulFix( bitmap_left, x_scale ) >> 6;
    
    2930
    +            glyph->bitmap_top  += FT_MulFix( bitmap_top,  y_scale ) >> 6;
    
    2931
    +          }
    
    2932
    +
    
    2909 2933
               /* sanity checks: if `xxxAdvance' in the sbit metric */
    
    2910 2934
               /* structure isn't set, use `linearXXXAdvance'      */
    
    2911 2935
               if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance )
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]