freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][undefined_scale] [base] Undefined scale means n


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][undefined_scale] [base] Undefined scale means no scale.
Date: Thu, 20 Jan 2022 03:16:07 +0000

Alexei Podtelezhnikov pushed to branch undefined_scale at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • include/freetype/freetype.h
    ... ... @@ -522,13 +522,13 @@ FT_BEGIN_HEADER
    522 522
        *   size.
    
    523 523
        *
    
    524 524
        * @note:
    
    525
    -   *   An @FT_Face has one _active_ @FT_Size object that is used by functions
    
    526
    -   *   like @FT_Load_Glyph to determine the scaling transformation that in
    
    527
    -   *   turn is used to load and hint glyphs and metrics.
    
    525
    +   *   An @FT_Face has one _active_ `FT_Size` object that is used by
    
    526
    +   *   functions like @FT_Load_Glyph to determine the scaling transformation
    
    527
    +   *   that in turn is used to load and hint glyphs and metrics.
    
    528 528
        *
    
    529 529
        *   You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, @FT_Request_Size
    
    530 530
        *   or even @FT_Select_Size to change the content (i.e., the scaling
    
    531
    -   *   values) of the active @FT_Size.
    
    531
    +   *   values) of the active `FT_Size`.
    
    532 532
        *
    
    533 533
        *   You can use @FT_New_Size to create additional size objects for a given
    
    534 534
        *   @FT_Face, but they won't be used by other functions until you activate
    
    ... ... @@ -2702,8 +2702,8 @@ FT_BEGIN_HEADER
    2702 2702
        *   'https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'.
    
    2703 2703
        *
    
    2704 2704
        *   Contrary to @FT_Set_Char_Size, this function doesn't have special code
    
    2705
    -   *   to normalize zero-valued widths, heights, or resolutions (which lead
    
    2706
    -   *   to errors in most cases).
    
    2705
    +   *   to normalize zero-valued widths, heights, or resolutions, which are
    
    2706
    +   *   treated as @FT_LOAD_NO_SCALE.
    
    2707 2707
        *
    
    2708 2708
        *   Don't use this function if you are using the FreeType cache API.
    
    2709 2709
        */
    
    ... ... @@ -2819,7 +2819,7 @@ FT_BEGIN_HEADER
    2819 2819
        *
    
    2820 2820
        *   load_flags ::
    
    2821 2821
        *     A flag indicating what to load for this glyph.  The @FT_LOAD_XXX
    
    2822
    -   *     constants can be used to control the glyph loading process (e.g.,
    
    2822
    +   *     flags can be used to control the glyph loading process (e.g.,
    
    2823 2823
        *     whether the outline should be scaled, whether to load bitmaps or
    
    2824 2824
        *     not, whether to hint the outline, etc).
    
    2825 2825
        *
    
    ... ... @@ -2827,6 +2827,9 @@ FT_BEGIN_HEADER
    2827 2827
        *   FreeType error code.  0~means success.
    
    2828 2828
        *
    
    2829 2829
        * @note:
    
    2830
    +   *   For proper scaling and hinting, the active @FT_Size object owned by
    
    2831
    +   *   the face has to be meaningfully non-trivially initialized by
    
    2832
    +   *   calling @FT_Set_Char_Size before this function, for example.
    
    2830 2833
        *   The loaded glyph may be transformed.  See @FT_Set_Transform for the
    
    2831 2834
        *   details.
    
    2832 2835
        *
    
    ... ... @@ -2918,6 +2921,8 @@ FT_BEGIN_HEADER
    2918 2921
        *
    
    2919 2922
        *   FT_LOAD_NO_SCALE ::
    
    2920 2923
        *     Don't scale the loaded outline glyph but keep it in font units.
    
    2924
    +   *     This flag is also assumed if @FT_Size owned by the face was not
    
    2925
    +   *     properly initialized.
    
    2921 2926
        *
    
    2922 2927
        *     This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
    
    2923 2928
        *     unsets @FT_LOAD_RENDER.
    
    ... ... @@ -3410,7 +3415,7 @@ FT_BEGIN_HEADER
    3410 3415
        *     @FT_Render_Mode for a list of possible values.
    
    3411 3416
        *
    
    3412 3417
        *     If @FT_RENDER_MODE_NORMAL is used, a previous call of @FT_Load_Glyph
    
    3413
    -   *     with flag @FT_LOAD_COLOR makes FT_Render_Glyph provide a default
    
    3418
    +   *     with flag @FT_LOAD_COLOR makes `FT_Render_Glyph` provide a default
    
    3414 3419
        *     blending of colored glyph layers associated with the current glyph
    
    3415 3420
        *     slot (provided the font contains such layers) instead of rendering
    
    3416 3421
        *     the glyph slot's outline.  This is an experimental feature; see
    
    ... ... @@ -3420,9 +3425,6 @@ FT_BEGIN_HEADER
    3420 3425
        *   FreeType error code.  0~means success.
    
    3421 3426
        *
    
    3422 3427
        * @note:
    
    3423
    -   *   To get meaningful results, font scaling values must be set with
    
    3424
    -   *   functions like @FT_Set_Char_Size before calling `FT_Render_Glyph`.
    
    3425
    -   *
    
    3426 3428
        *   When FreeType outputs a bitmap of a glyph, it really outputs an alpha
    
    3427 3429
        *   coverage map.  If a pixel is completely covered by a filled-in
    
    3428 3430
        *   outline, the bitmap contains 0xFF at that pixel, meaning that
    

  • src/base/ftobjs.c
    ... ... @@ -858,6 +858,11 @@
    858 858
         library = driver->root.library;
    
    859 859
         hinter  = library->auto_hinter;
    
    860 860
     
    
    861
    +    /* undefined scale means no scale */
    
    862
    +    if ( face->size->metrics.x_ppem == 0 ||
    
    863
    +         face->size->metrics.y_ppem == 0 )
    
    864
    +      load_flags |= FT_LOAD_NO_SCALE;
    
    865
    +
    
    861 866
         /* resolve load flags dependencies */
    
    862 867
     
    
    863 868
         if ( load_flags & FT_LOAD_NO_RECURSE )
    


  • reply via email to

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