... |
... |
@@ -194,6 +194,9 @@ |
194
|
194
|
float vertBearingX, vertBearingY;
|
195
|
195
|
float tmpf;
|
196
|
196
|
|
|
197
|
+ char *id;
|
|
198
|
+ char str[32];
|
|
199
|
+
|
197
|
200
|
|
198
|
201
|
/* If `cache` is `TRUE` we store calculations in the actual port */
|
199
|
202
|
/* state variable, otherwise we just create a dummy variable and */
|
... |
... |
@@ -320,69 +323,43 @@ |
320
|
323
|
/* If the document contains only one glyph, `start_glyph_id` and */
|
321
|
324
|
/* `end_glyph_id` have the same value. Otherwise `end_glyph_id` */
|
322
|
325
|
/* is larger. */
|
323
|
|
- if ( start_glyph_id == end_glyph_id )
|
|
326
|
+ if ( start_glyph_id < end_glyph_id )
|
324
|
327
|
{
|
325
|
|
- /* Render the whole document to the recording surface. */
|
326
|
|
-#if LIBRSVG_CHECK_VERSION( 2, 52, 0 )
|
327
|
|
- {
|
328
|
|
- RsvgRectangle viewport =
|
329
|
|
- {
|
330
|
|
- .x = 0,
|
331
|
|
- .y = 0,
|
332
|
|
- .width = (double)dimension_svg.width,
|
333
|
|
- .height = (double)dimension_svg.height,
|
334
|
|
- };
|
335
|
|
-
|
336
|
|
-
|
337
|
|
- ret = rsvg_handle_render_document( handle,
|
338
|
|
- rec_cr,
|
339
|
|
- &viewport,
|
340
|
|
- NULL );
|
341
|
|
- }
|
342
|
|
-#else
|
343
|
|
- ret = rsvg_handle_render_cairo( handle, rec_cr );
|
344
|
|
-#endif
|
345
|
|
-
|
346
|
|
- if ( ret == FALSE )
|
347
|
|
- {
|
348
|
|
- error = FT_Err_Invalid_SVG_Document;
|
349
|
|
- goto CleanCairo;
|
350
|
|
- }
|
|
328
|
+ /* Render only the element with its ID equal to `glyph<ID>`. */
|
|
329
|
+ sprintf( str, "#glyph%u", slot->glyph_index );
|
|
330
|
+ id = str;
|
351
|
331
|
}
|
352
|
|
- else if ( start_glyph_id < end_glyph_id )
|
|
332
|
+ else
|
353
|
333
|
{
|
354
|
|
- char str[32] = "#glyph";
|
355
|
|
-
|
356
|
|
-
|
357
|
|
- /* Render only the element with its ID equal to `glyph<ID>`. */
|
358
|
|
- sprintf( str + 6, "%u", slot->glyph_index );
|
|
334
|
+ /* NULL = Render the whole document */
|
|
335
|
+ id = NULL;
|
|
336
|
+ }
|
359
|
337
|
|
360
|
338
|
#if LIBRSVG_CHECK_VERSION( 2, 52, 0 )
|
|
339
|
+ {
|
|
340
|
+ RsvgRectangle viewport =
|
361
|
341
|
{
|
362
|
|
- RsvgRectangle viewport =
|
363
|
|
- {
|
364
|
|
- .x = 0,
|
365
|
|
- .y = 0,
|
366
|
|
- .width = (double)dimension_svg.width,
|
367
|
|
- .height = (double)dimension_svg.height,
|
368
|
|
- };
|
369
|
|
-
|
370
|
|
-
|
371
|
|
- ret = rsvg_handle_render_layer( handle,
|
372
|
|
- rec_cr,
|
373
|
|
- str,
|
374
|
|
- &viewport,
|
375
|
|
- NULL );
|
376
|
|
- }
|
|
342
|
+ .x = 0,
|
|
343
|
+ .y = 0,
|
|
344
|
+ .width = (double)dimension_svg.width,
|
|
345
|
+ .height = (double)dimension_svg.height,
|
|
346
|
+ };
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+ ret = rsvg_handle_render_layer( handle,
|
|
350
|
+ rec_cr,
|
|
351
|
+ id,
|
|
352
|
+ &viewport,
|
|
353
|
+ NULL );
|
|
354
|
+ }
|
377
|
355
|
#else
|
378
|
|
- ret = rsvg_handle_render_cairo_sub( handle, rec_cr, str );
|
|
356
|
+ ret = rsvg_handle_render_cairo_sub( handle, rec_cr, id );
|
379
|
357
|
#endif
|
380
|
358
|
|
381
|
|
- if ( ret == FALSE )
|
382
|
|
- {
|
383
|
|
- error = FT_Err_Invalid_SVG_Document;
|
384
|
|
- goto CleanCairo;
|
385
|
|
- }
|
|
359
|
+ if ( ret == FALSE )
|
|
360
|
+ {
|
|
361
|
+ error = FT_Err_Invalid_SVG_Document;
|
|
362
|
+ goto CleanCairo;
|
386
|
363
|
}
|
387
|
364
|
|
388
|
365
|
/* Get the bounding box of the drawing. */
|