freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][gsoc-anurag-2023] Work on preloading font outli


From: Anurag Thakur (@AdbhutDev)
Subject: [Git][freetype/freetype][gsoc-anurag-2023] Work on preloading font outlines
Date: Mon, 14 Aug 2023 14:21:48 +0000

Anurag Thakur pushed to branch gsoc-anurag-2023 at FreeType / FreeType

Commits:

  • 36f6131c
    by Anurag Thakur at 2023-08-14T19:51:22+05:30
    Work on preloading font outlines
    

2 changed files:

Changes:

  • include/freetype/freetype.h
    ... ... @@ -2399,6 +2399,9 @@ FT_BEGIN_HEADER
    2399 2399
        *   FT_OPEN_PARAMS ::
    
    2400 2400
        *     Use the `num_params` and `params` fields.
    
    2401 2401
        *
    
    2402
    +   *   FT_OPEN_PRELOAD ::
    
    2403
    +   *     Preprocess the font outline to save cpu time later.
    
    2404
    +   *
    
    2402 2405
        * @note:
    
    2403 2406
        *   The `FT_OPEN_MEMORY`, `FT_OPEN_STREAM`, and `FT_OPEN_PATHNAME` flags
    
    2404 2407
        *   are mutually exclusive.
    
    ... ... @@ -2408,7 +2411,7 @@ FT_BEGIN_HEADER
    2408 2411
     #define FT_OPEN_PATHNAME  0x4
    
    2409 2412
     #define FT_OPEN_DRIVER    0x8
    
    2410 2413
     #define FT_OPEN_PARAMS    0x10
    
    2411
    -
    
    2414
    +#define FT_OPEN_PRELOAD   0x12
    
    2412 2415
     
    
    2413 2416
       /* these constants are deprecated; use the corresponding `FT_OPEN_XXX` */
    
    2414 2417
       /* values instead                                                      */
    

  • src/base/ftobjs.c
    ... ... @@ -1622,6 +1622,27 @@
    1622 1622
         return ft_open_face_internal( library, &args, face_index, aface, 1 );
    
    1623 1623
       }
    
    1624 1624
     
    
    1625
    +
    
    1626
    +  FT_EXPORT_DEF( FT_Error )
    
    1627
    +  FT_New_Face2( FT_Library   library,
    
    1628
    +               const char*  pathname,
    
    1629
    +               FT_Long      face_index,
    
    1630
    +               FT_Face     *aface,
    
    1631
    +               FT_Open_Args args)
    
    1632
    +  {
    
    1633
    +
    
    1634
    +    /* test for valid `library' and `aface' delayed to `FT_Open_Face' */
    
    1635
    +    if ( !pathname )
    
    1636
    +      return FT_THROW( Invalid_Argument );
    
    1637
    +
    
    1638
    +    args.flags    |= FT_OPEN_PATHNAME;
    
    1639
    +    args.pathname = (char*)pathname;
    
    1640
    +    args.stream   = NULL;
    
    1641
    +
    
    1642
    +    return ft_open_face_internal( library, &args, face_index, aface, 1 );
    
    1643
    +  }
    
    1644
    +
    
    1645
    +
    
    1625 1646
     #endif
    
    1626 1647
     
    
    1627 1648
     
    
    ... ... @@ -2636,7 +2657,6 @@
    2636 2657
     
    
    2637 2658
               driver = FT_DRIVER( cur[0] );
    
    2638 2659
     
    
    2639
    -          // TODO: Check the args for a "preload" flag and act accordingly
    
    2640 2660
               if ( args->flags & FT_OPEN_PARAMS )
    
    2641 2661
               {
    
    2642 2662
                 num_params = args->num_params;
    
    ... ... @@ -2727,7 +2747,12 @@
    2727 2747
         /* face->driver instead.                                   */
    
    2728 2748
         FT_List_Add( &face->driver->faces_list, node );
    
    2729 2749
     
    
    2730
    -    // TODO: The preload logic should be performed here
    
    2750
    +    if (args->flags & FT_OPEN_PRELOAD)
    
    2751
    +    {
    
    2752
    +      /* Preload the font here */
    
    2753
    +    }
    
    2754
    +    
    
    2755
    +
    
    2731 2756
         /* now allocate a glyph slot object for the face */
    
    2732 2757
         FT_TRACE4(( "FT_Open_Face: Creating glyph slot\n" ));
    
    2733 2758
     
    


  • reply via email to

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