OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* afloader.c */ | 3 /* afloader.c */ |
4 /* */ | 4 /* */ |
5 /* Auto-fitter glyph loading routines (body). */ | 5 /* Auto-fitter glyph loading routines (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 2003-2009, 2011 by */ | 7 /* Copyright 2003-2009, 2011-2012 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
11 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 /* for mono-width fonts (like Andale, Courier, etc.) we need */ | 426 /* for mono-width fonts (like Andale, Courier, etc.) we need */ |
427 /* to keep the original rounded advance width; ditto for */ | 427 /* to keep the original rounded advance width; ditto for */ |
428 /* digits if all have the same advance width */ | 428 /* digits if all have the same advance width */ |
429 #if 0 | 429 #if 0 |
430 if ( !FT_IS_FIXED_WIDTH( slot->face ) ) | 430 if ( !FT_IS_FIXED_WIDTH( slot->face ) ) |
431 slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; | 431 slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; |
432 else | 432 else |
433 slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, | 433 slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, |
434 x_scale ); | 434 x_scale ); |
435 #else | 435 #else |
436 if ( FT_IS_FIXED_WIDTH( slot->face ) || | 436 if ( scaler->render_mode != FT_RENDER_MODE_LIGHT && |
437 ( af_face_globals_is_digit( loader->globals, glyph_index ) && | 437 ( FT_IS_FIXED_WIDTH( slot->face ) || |
438 metrics->digits_have_same_width ) ) | 438 ( af_face_globals_is_digit( loader->globals, glyph_index ) && |
| 439 metrics->digits_have_same_width ) ) ) |
439 { | 440 { |
440 slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, | 441 slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, |
441 metrics->scaler.x_scale ); | 442 metrics->scaler.x_scale ); |
442 | 443 |
443 /* Set delta values to 0. Otherwise code that uses them is */ | 444 /* Set delta values to 0. Otherwise code that uses them is */ |
444 /* going to ruin the fixed advance width. */ | 445 /* going to ruin the fixed advance width. */ |
445 slot->lsb_delta = 0; | 446 slot->lsb_delta = 0; |
446 slot->rsb_delta = 0; | 447 slot->rsb_delta = 0; |
447 } | 448 } |
448 else | 449 else |
449 { | 450 { |
450 /* non-spacing glyphs must stay as-is */ | 451 /* non-spacing glyphs must stay as-is */ |
451 if ( slot->metrics.horiAdvance ) | 452 if ( slot->metrics.horiAdvance ) |
452 slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; | 453 slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; |
453 } | 454 } |
454 #endif | 455 #endif |
455 | 456 |
456 slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance, | 457 slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance, |
457 metrics->scaler.y_scale ); | 458 metrics->scaler.y_scale ); |
458 | 459 |
459 slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); | 460 slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); |
460 slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance ); | 461 slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance ); |
461 | 462 |
462 /* now copy outline into glyph slot */ | 463 /* now copy outline into glyph slot */ |
463 FT_GlyphLoader_Rewind( internal->loader ); | 464 FT_GlyphLoader_Rewind( internal->loader ); |
464 error = FT_GlyphLoader_CopyPoints( internal->loader, gloader ); | 465 error = FT_GlyphLoader_CopyPoints( internal->loader, gloader ); |
465 if ( error ) | 466 if ( error ) |
466 goto Exit; | 467 goto Exit; |
467 | 468 |
468 slot->outline = internal->loader->base.outline; | 469 /* reassign all outline fields except flags to protect them */ |
| 470 slot->outline.n_contours = internal->loader->base.outline.n_contours; |
| 471 slot->outline.n_points = internal->loader->base.outline.n_points; |
| 472 slot->outline.points = internal->loader->base.outline.points; |
| 473 slot->outline.tags = internal->loader->base.outline.tags; |
| 474 slot->outline.contours = internal->loader->base.outline.contours; |
| 475 |
469 slot->format = FT_GLYPH_FORMAT_OUTLINE; | 476 slot->format = FT_GLYPH_FORMAT_OUTLINE; |
470 } | 477 } |
471 | 478 |
472 Exit: | 479 Exit: |
473 return error; | 480 return error; |
474 } | 481 } |
475 | 482 |
476 | 483 |
477 /* Load a glyph. */ | 484 /* Load a glyph. */ |
478 | 485 |
479 FT_LOCAL_DEF( FT_Error ) | 486 FT_LOCAL_DEF( FT_Error ) |
480 af_loader_load_glyph( AF_Loader loader, | 487 af_loader_load_glyph( AF_Loader loader, |
481 FT_Face face, | 488 FT_Face face, |
482 FT_UInt gindex, | 489 FT_UInt gindex, |
483 FT_UInt32 load_flags ) | 490 FT_Int32 load_flags ) |
484 { | 491 { |
485 FT_Error error; | 492 FT_Error error; |
486 FT_Size size = face->size; | 493 FT_Size size = face->size; |
487 AF_ScalerRec scaler; | 494 AF_ScalerRec scaler; |
488 | 495 |
489 | 496 |
490 if ( !size ) | 497 if ( !size ) |
491 return AF_Err_Invalid_Argument; | 498 return AF_Err_Invalid_Argument; |
492 | 499 |
493 FT_ZERO( &scaler ); | 500 FT_ZERO( &scaler ); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 | 545 |
539 error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 ); | 546 error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 ); |
540 } | 547 } |
541 } | 548 } |
542 Exit: | 549 Exit: |
543 return error; | 550 return error; |
544 } | 551 } |
545 | 552 |
546 | 553 |
547 /* END */ | 554 /* END */ |
OLD | NEW |