David PHAM-VAN

Fix TTF font parser for NewsCycle-Regular.ttf

@@ -417,9 +417,12 @@ class TtfParser { @@ -417,9 +417,12 @@ class TtfParser {
417 } 417 }
418 418
419 TtfGlyphInfo _readCompoundGlyph(int glyph, int start, int offset) { 419 TtfGlyphInfo _readCompoundGlyph(int glyph, int start, int offset) {
420 - const ARG_1_AND_2_ARE_WORDS = 1;  
421 - const MORE_COMPONENTS = 32;  
422 - const WE_HAVE_INSTRUCTIONS = 256; 420 + const ARG_1_AND_2_ARE_WORDS = 0x0001;
  421 + const HAS_SCALE = 0x008;
  422 + const MORE_COMPONENTS = 0x0020;
  423 + const HAS_X_Y_SCALE = 0x0040;
  424 + const HAS_TRANFORMATION_MATRIX = 0x0080;
  425 + const WE_HAVE_INSTRUCTIONS = 0x0100;
423 426
424 final components = <int>[]; 427 final components = <int>[];
425 var hasInstructions = false; 428 var hasInstructions = false;
@@ -429,6 +432,13 @@ class TtfParser { @@ -429,6 +432,13 @@ class TtfParser {
429 flags = bytes.getUint16(offset); 432 flags = bytes.getUint16(offset);
430 final glyphIndex = bytes.getUint16(offset + 2); 433 final glyphIndex = bytes.getUint16(offset + 2);
431 offset += (flags & ARG_1_AND_2_ARE_WORDS != 0) ? 8 : 6; 434 offset += (flags & ARG_1_AND_2_ARE_WORDS != 0) ? 8 : 6;
  435 + if (flags & HAS_SCALE != 0) {
  436 + offset += 2;
  437 + } else if (flags & HAS_X_Y_SCALE != 0) {
  438 + offset += 4;
  439 + } else if (flags & HAS_TRANFORMATION_MATRIX != 0) {
  440 + offset += 8;
  441 + }
432 442
433 components.add(glyphIndex); 443 components.add(glyphIndex);
434 if (flags & WE_HAVE_INSTRUCTIONS != 0) { 444 if (flags & WE_HAVE_INSTRUCTIONS != 0) {
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 4
5 - Fix print dialog crash on Linux 5 - Fix print dialog crash on Linux
6 - Fix directPrint printer selection on macOS 6 - Fix directPrint printer selection on macOS
  7 +- Fix TTF font parser for NewsCycle-Regular.ttf
7 8
8 ## 5.6.7 9 ## 5.6.7
9 10