freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][wl/conditional-svg] Use 'librsvg' conditi


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype-demos][wl/conditional-svg] Use 'librsvg' conditionally.
Date: Tue, 25 Jan 2022 13:32:43 +0000

Werner Lemberg pushed to branch wl/conditional-svg at FreeType / FreeType Demo Programs

Commits:

5 changed files:

Changes:

  • Makefile
    ... ... @@ -132,7 +132,8 @@ else
    132 132
         #
    
    133 133
         # For the pure `make` call (without using `configure`) we have to add
    
    134 134
         # all needed cflags manually.
    
    135
    -    FT_DEMO_CFLAGS := $(shell pkg-config --cflags librsvg-2.0)
    
    135
    +    FT_DEMO_CFLAGS := $(shell pkg-config --cflags librsvg-2.0) \
    
    136
    +                      -DHAVE_LIBRSVG
    
    136 137
       endif
    
    137 138
     
    
    138 139
       FT_INCLUDES := $(OBJ_BUILD) \
    

  • meson.build
    ... ... @@ -77,6 +77,7 @@ ftcommon_lib = static_library('ftcommon',
    77 77
         'src/rsvg-port.c',
    
    78 78
         'src/rsvg-port.h',
    
    79 79
       ],
    
    80
    +  c_args: [-DHAVE_LIBRSVG],
    
    80 81
       dependencies: [libpng_dep, librsvg_dep, libfreetype2_dep],
    
    81 82
       include_directories: graph_include_dir,
    
    82 83
       link_with: [common_lib, graph_lib],
    

  • src/ftcommon.c
    ... ... @@ -27,7 +27,6 @@
    27 27
     
    
    28 28
     #include FT_BITMAP_H
    
    29 29
     #include FT_FONT_FORMATS_H
    
    30
    -#include FT_OTSVG_H
    
    31 30
     
    
    32 31
     
    
    33 32
       /* error messages */
    
    ... ... @@ -340,12 +339,6 @@
    340 339
       {
    
    341 340
         FTDemo_Handle*  handle;
    
    342 341
     
    
    343
    -    SVG_RendererHooks  hooks = {
    
    344
    -                         (SVG_Lib_Init_Func)rsvg_port_init,
    
    345
    -                         (SVG_Lib_Free_Func)rsvg_port_free,
    
    346
    -                         (SVG_Lib_Render_Func)rsvg_port_render,
    
    347
    -                         (SVG_Lib_Preset_Slot_Func)rsvg_port_preset_slot };
    
    348
    -
    
    349 342
     
    
    350 343
         handle = (FTDemo_Handle *)malloc( sizeof ( FTDemo_Handle ) );
    
    351 344
         if ( !handle )
    
    ... ... @@ -357,8 +350,9 @@
    357 350
         if ( error )
    
    358 351
           PanicZ( "could not initialize FreeType" );
    
    359 352
     
    
    360
    -    /* XXX error handling? */
    
    361
    -    FT_Property_Set( handle->library, "ot-svg", "svg_hooks", &hooks );
    
    353
    +    /* The use of an external SVG rendering library is optional. */
    
    354
    +    (void)FT_Property_Set( handle->library,
    
    355
    +                           "ot-svg", "svg-hooks", &rsvg_hooks );
    
    362 356
     
    
    363 357
         error = FTC_Manager_New( handle->library, 0, 0, 0,
    
    364 358
                                  my_face_requester, 0, &handle->cache_manager );
    

  • src/rsvg-port.c
    ... ... @@ -16,6 +16,11 @@
    16 16
      *
    
    17 17
      */
    
    18 18
     
    
    19
    +#include <ft2build.h>
    
    20
    +#include FT_OTSVG_H
    
    21
    +
    
    22
    +#ifdef HAVE_LIBRSVG
    
    23
    +
    
    19 24
     #include <cairo.h>
    
    20 25
     #include <librsvg/rsvg.h>
    
    21 26
     #include <stdlib.h>
    
    ... ... @@ -397,4 +402,18 @@
    397 402
       }
    
    398 403
     
    
    399 404
     
    
    405
    +  SVG_RendererHooks  rsvg_hooks = {
    
    406
    +                       (SVG_Lib_Init_Func)rsvg_port_init,
    
    407
    +                       (SVG_Lib_Free_Func)rsvg_port_free,
    
    408
    +                       (SVG_Lib_Render_Func)rsvg_port_render,
    
    409
    +                       (SVG_Lib_Preset_Slot_Func)rsvg_port_preset_slot
    
    410
    +                     };
    
    411
    +
    
    412
    +#else /* !HAVE_LIBRSVG */
    
    413
    +
    
    414
    +  SVG_RendererHooks  rsvg_hooks = { NULL, NULL, NULL, NULL };
    
    415
    +
    
    416
    +#endif /* !HAVE_LIBRSVG */
    
    417
    +
    
    418
    +
    
    400 419
     /* End */

  • src/rsvg-port.h
    ... ... @@ -19,6 +19,11 @@
    19 19
     #ifndef RSVG_PORT_H
    
    20 20
     #define RSVG_PORT_H
    
    21 21
     
    
    22
    +#include <ft2build.h>
    
    23
    +#include FT_OTSVG_H
    
    24
    +
    
    25
    +#ifdef HAVE_LIBRSVG
    
    26
    +
    
    22 27
     #include <cairo.h>
    
    23 28
     #include <librsvg/rsvg.h>
    
    24 29
     #include <ft2build.h>
    
    ... ... @@ -57,6 +62,11 @@
    57 62
                              FT_Bool       cache,
    
    58 63
                              FT_Pointer   *state );
    
    59 64
     
    
    65
    +#endif /* HAVE_LIBRSVG */
    
    66
    +
    
    67
    +
    
    68
    +  extern SVG_RendererHooks  rsvg_hooks;
    
    69
    +
    
    60 70
     #endif /* RSVG_PORT_H */
    
    61 71
     
    
    62 72
     
    


  • reply via email to

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