28 views
in System Integration by

Hi team,

I am using Noto-sans fonts to generate the glyphs for range 0x20-0xFF and a few glyphs generated(e.g. glyph 0x007F) looks incorrect as their parameter aOriginX, aOriginY, aWidth, aHeight are 0 and other parameters aAdvance and aPixel remain same for other glyphs too.

Please check the below code for reference :

 

/* This is a font resource. */
EW_DEFINE_FONT_RES( FontsFontM, 22, 6, 0, 16, 0x0000, 0x0261 )
  EW_GLYPH( 0x0001, 2, -15, 9, 15, 12, 0x00000000 ),
  EW_GLYPH( 0x0020, 0, 0, 0, 0, 4, 0x0000010F ),                /* ' ' */
  EW_GLYPH( 0x0021, 1, -15, 4, 15, 6, 0x0000010F ),             /* '!' */
  EW_GLYPH( 0x0022, 2, -14, 5, 6, 9, 0x00000197 ),              /* '"' */
  EW_GLYPH( 0x0023, 1, -14, 9, 14, 11, 0x000001F3 ),            /* '#' */
  EW_GLYPH( 0x0024, 0, -16, 9, 19, 11, 0x00000390 ),            /* '$' */
  EW_GLYPH( 0x0025, 1, -14, 16, 14, 17, 0x00000590 ),           /* '%' */
  EW_GLYPH( 0x0026, 1, -14, 12, 14, 13, 0x0000083B ),           /* '&' */
  EW_GLYPH( 0x0027, 2, -14, 2, 6, 5, 0x00000A80 ),              /* ''' */
  EW_GLYPH( 0x0028, 2, -16, 4, 20, 6, 0x00000AAD ),             /* '(' */
  EW_GLYPH( 0x0029, 0, -16, 5, 20, 6, 0x00000B91 ),             /* ')' */
  EW_GLYPH( 0x002A, 1, -15, 7, 7, 9, 0x00000C82 ),              /* '*' */
  EW_GLYPH( 0x002B, 0, -11, 10, 10, 11, 0x00000D1D ),           /* '+' */
  EW_GLYPH( 0x002C, 1, -3, 4, 7, 5, 0x00000DF8 ),               /* ',' */
  EW_GLYPH( 0x002D, 1, -6, 5, 2, 7, 0x00000E62 ),               /* '-' */
  EW_GLYPH( 0x002E, 2, -3, 3, 3, 5, 0x00000E97 ),               /* '.' */
  EW_GLYPH( 0x002F, 0, -16, 7, 19, 7, 0x00000EBF ),             /* '/' */
  EW_GLYPH( 0x0030, 1, -14, 9, 14, 11, 0x00000FF8 ),            /* '0' */
  EW_GLYPH( 0x0031, 2, -14, 8, 14, 11, 0x000011A8 ),            /* '1' */
  EW_GLYPH( 0x0032, 1, -14, 9, 14, 11, 0x00001282 ),            /* '2' */
  EW_GLYPH( 0x0033, 0, -14, 10, 14, 11, 0x00001406 ),           /* '3' */
  EW_GLYPH( 0x0034, 0, -14, 10, 14, 11, 0x000015DA ),           /* '4' */
  EW_GLYPH( 0x0035, 1, -14, 9, 14, 11, 0x00001737 ),            /* '5' */
  EW_GLYPH( 0x0036, 1, -14, 9, 14, 11, 0x000018DB ),            /* '6' */
  EW_GLYPH( 0x0037, 1, -14, 9, 14, 11, 0x00001ABD ),            /* '7' */
  EW_GLYPH( 0x0038, 1, -14, 9, 14, 11, 0x00001C06 ),            /* '8' */
  EW_GLYPH( 0x0039, 1, -14, 9, 14, 11, 0x00001DF7 ),            /* '9' */
  EW_GLYPH( 0x003A, 2, -10, 3, 10, 5, 0x00001FCE ),             /* ':' */
  EW_GLYPH( 0x003B, 1, -10, 4, 14, 5, 0x0000203B ),             /* ';' */
  EW_GLYPH( 0x003C, 1, -12, 9, 9, 11, 0x000020EE ),             /* '<' */
  EW_GLYPH( 0x003D, 1, -10, 9, 7, 11, 0x00002211 ),             /* '=' */
  EW_GLYPH( 0x003E, 1, -12, 9, 9, 11, 0x00002304 ),             /* '>' */
  EW_GLYPH( 0x003F, 1, -14, 7, 14, 9, 0x00002427 ),             /* '?' */
  EW_GLYPH( 0x0040, 1, -14, 16, 17, 18, 0x00002546 ),           /* '@' */
  EW_GLYPH( 0x0041, 0, -14, 12, 14, 12, 0x000028FA ),           /* 'A' */
  EW_GLYPH( 0x0042, 2, -14, 10, 14, 12, 0x00002ACE ),           /* 'B' */
  EW_GLYPH( 0x0043, 1, -14, 11, 14, 12, 0x00002C99 ),           /* 'C' */
  EW_GLYPH( 0x0044, 2, -14, 10, 14, 13, 0x00002E4E ),           /* 'D' */
  EW_GLYPH( 0x0045, 2, -14, 9, 14, 11, 0x00002FCE ),            /* 'E' */
  EW_GLYPH( 0x0046, 2, -14, 8, 14, 10, 0x00003115 ),            /* 'F' */
  EW_GLYPH( 0x0047, 1, -14, 11, 14, 13, 0x00003217 ),           /* 'G' */
  EW_GLYPH( 0x0048, 2, -14, 10, 14, 14, 0x00003414 ),           /* 'H' */
  EW_GLYPH( 0x0049, 2, -14, 2, 14, 6, 0x0000350A ),             /* 'I' */
  EW_GLYPH( 0x004A, 0, -14, 8, 14, 10, 0x00003530 ),            /* 'J' */
  EW_GLYPH( 0x004B, 2, -14, 11, 14, 12, 0x000035FD ),           /* 'K' */
  EW_GLYPH( 0x004C, 2, -14, 8, 14, 10, 0x00003789 ),            /* 'L' */
  EW_GLYPH( 0x004D, 2, -14, 12, 14, 15, 0x00003836 ),           /* 'M' */
  EW_GLYPH( 0x004E, 2, -14, 10, 14, 14, 0x000039DC ),           /* 'N' */
  EW_GLYPH( 0x004F, 1, -14, 12, 14, 14, 0x00003B0B ),           /* 'O' */
  EW_GLYPH( 0x0050, 2, -14, 9, 14, 12, 0x00003D18 ),            /* 'P' */
  EW_GLYPH( 0x0051, 1, -14, 13, 17, 14, 0x00003E62 ),           /* 'Q' */
  EW_GLYPH( 0x0052, 2, -14, 10, 14, 12, 0x000040F4 ),           /* 'R' */
  EW_GLYPH( 0x0053, 0, -14, 11, 14, 11, 0x0000427C ),           /* 'S' */
  EW_GLYPH( 0x0054, 1, -14, 11, 14, 11, 0x00004491 ),           /* 'T' */
  EW_GLYPH( 0x0055, 2, -14, 10, 14, 14, 0x0000459C ),           /* 'U' */
  EW_GLYPH( 0x0056, 0, -14, 11, 14, 11, 0x000046B5 ),           /* 'V' */
  EW_GLYPH( 0x0057, 0, -14, 16, 14, 17, 0x00004848 ),           /* 'W' */
  EW_GLYPH( 0x0058, 0, -14, 11, 14, 11, 0x00004AC5 ),           /* 'X' */
  EW_GLYPH( 0x0059, 0, -14, 10, 14, 10, 0x00004C86 ),           /* 'Y' */
  EW_GLYPH( 0x005A, 1, -14, 10, 14, 11, 0x00004DC7 ),           /* 'Z' */
  EW_GLYPH( 0x005B, 2, -15, 4, 18, 6, 0x00004F73 ),             /* '[' */
  EW_GLYPH( 0x005C, 0, -16, 7, 19, 7, 0x00004FE9 ),             /* '\' */
  EW_GLYPH( 0x005D, 0, -15, 5, 18, 6, 0x00005120 ),             /* ']' */
  EW_GLYPH( 0x005E, 1, -14, 8, 8, 11, 0x000051A6 ),             /* '^' */
  EW_GLYPH( 0x005F, 0, 1, 10, 2, 11, 0x0000527D ),              /* '_' */
  EW_GLYPH( 0x0060, 3, -16, 5, 5, 12, 0x000052E1 ),             /* '`' */
  EW_GLYPH( 0x0061, 1, -11, 8, 11, 11, 0x0000533B ),            /* 'a' */
  EW_GLYPH( 0x0062, 2, -16, 9, 16, 12, 0x000054A8 ),            /* 'b' */
  EW_GLYPH( 0x0063, 1, -11, 8, 11, 10, 0x00005612 ),            /* 'c' */
  EW_GLYPH( 0x0064, 1, -16, 9, 16, 12, 0x00005741 ),            /* 'd' */
  EW_GLYPH( 0x0065, 1, -11, 9, 11, 11, 0x000058B7 ),            /* 'e' */
  EW_GLYPH( 0x0066, 0, -15, 7, 15, 6, 0x00005A55 ),             /* 'f' */
  EW_GLYPH( 0x0067, 1, -11, 10, 15, 11, 0x00005B36 ),           /* 'g' */
  EW_GLYPH( 0x0068, 2, -16, 8, 16, 12, 0x00005D93 ),            /* 'h' */
  EW_GLYPH( 0x0069, 2, -15, 3, 15, 5, 0x00005E84 ),             /* 'i' */
  EW_GLYPH( 0x006A, -1, -15, 6, 19, 5, 0x00005EE2 ),            /* 'j' */
  EW_GLYPH( 0x006B, 2, -16, 9, 16, 10, 0x00005FA6 ),            /* 'k' */
  EW_GLYPH( 0x006C, 2, -16, 3, 16, 5, 0x000060F7 ),             /* 'l' */
  EW_GLYPH( 0x006D, 2, -11, 14, 11, 18, 0x0000614D ),           /* 'm' */
  EW_GLYPH( 0x006E, 2, -11, 8, 11, 12, 0x000062AB ),            /* 'n' */
  EW_GLYPH( 0x006F, 1, -11, 10, 11, 12, 0x0000636D ),           /* 'o' */
  EW_GLYPH( 0x0070, 2, -11, 9, 15, 12, 0x00006503 ),            /* 'p' */
  EW_GLYPH( 0x0071, 1, -11, 9, 15, 12, 0x00006676 ),            /* 'q' */
  EW_GLYPH( 0x0072, 2, -11, 6, 11, 7, 0x000067F2 ),             /* 'r' */
  EW_GLYPH( 0x0073, 0, -11, 8, 11, 9, 0x00006884 ),             /* 's' */
  EW_GLYPH( 0x0074, 0, -14, 7, 14, 7, 0x000069DE ),             /* 't' */
  EW_GLYPH( 0x0075, 1, -11, 9, 11, 12, 0x00006AC2 ),            /* 'u' */
  EW_GLYPH( 0x0076, 0, -11, 10, 11, 10, 0x00006B92 ),           /* 'v' */
  EW_GLYPH( 0x0077, 1, -11, 15, 11, 15, 0x00006CCA ),           /* 'w' */
  EW_GLYPH( 0x0078, 0, -11, 9, 11, 9, 0x00006EA8 ),             /* 'x' */
  EW_GLYPH( 0x0079, 0, -11, 10, 15, 10, 0x00006FFA ),           /* 'y' */
  EW_GLYPH( 0x007A, 1, -11, 8, 11, 9, 0x00007199 ),             /* 'z' */
  EW_GLYPH( 0x007B, 1, -15, 5, 18, 6, 0x000072D0 ),             /* '{' */
  EW_GLYPH( 0x007C, 2, -17, 2, 22, 5, 0x0000739E ),             /* '|' */
  EW_GLYPH( 0x007D, 0, -15, 6, 18, 6, 0x000073D6 ),             /* '}' */
  EW_GLYPH( 0x007E, 1, -9, 9, 4, 11, 0x000074CD ),              /* '~' */
  EW_GLYPH( 0x007F, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0080, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0081, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0082, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0083, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0084, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0085, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0086, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0087, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0088, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0089, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x008A, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x008B, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x008C, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x008D, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x008E, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x008F, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0090, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0091, 0, 0, 0, 0, 4, 0x00007553 ),
  EW_GLYPH( 0x0092, 0, 0, 0, 0, 4, 0x00007553 ),

 

Let us know if these generated glyphs are fine or could lead any issues in future.

Also, could you please describe the relation between EW_FONT_PIXEL and EW_GLYPH .

 

Regards,

Vikas 

1 Answer

0 votes
by

Hello Vikas,

from the generated code it seems that the glyphs 0x7F..0x92 are all empty (without content) and all have the advance of 4 pixel. It is as if all the glyphs were 4 pixel wide blanks. I tried to reproduce this situation. Following are my observations:

1. The glyphs 0x7F..0x92 are not existing in the Noto-sans font.

2. Such not existing glyphs are under normal circumstances never generated. Following is the normally expected output from my test. The range 0x7F..0x9F is empty as expected:

  ...

  EW_GLYPH( 0x007D, 1, -20, 8, 24, 9, 0x0000A8FB ),             /* '}' */
  EW_GLYPH( 0x007E, 1, -10, 11, 4, 13, 0x0000AA7B ),            /* '~' */
  EW_GLYPH( 0x00A0, 0, 0, 0, 0, 6, 0x0000AB2F ),
  EW_GLYPH( 0x00A1, 1, -13, 4, 17, 6, 0x0000AB2F ),
  EW_GLYPH( 0x00A2, 2, -17, 10, 17, 13, 0x0000ABE2 ),

  ...

3. At the runtime when the application accesses such not existing glyph, the corresponding functionality automatically falls back to the so-called default glyph. The appearance of the default glyph is specific to the particular font. Usually, it appears as an empty box (rectangle), a question mark, etc. If the font does not provide any default glyph, then even no default glyph is used.

From your generated code it seems that there is in fact no default glyph available. The corresponding  value is 0x0000 in the font resource:

  EW_DEFINE_FONT_RES( FontsFontM, 22, 6, 0, 16, 0x0000, 0x0261 )

This observation is confusing me a little bit because Noto Sans has very well a default glyph coded with 0x0001. This is the output in my test:

  EW_DEFINE_FONT_RES( ApplicationFont, 31, 9, 0, 16, 0x0001, 0x00C0 )

What can be the reason for this discrepancy?

Reason 1: You are using another version of the Noto Sans font than the version installed on my machine.

Reason 2: The corresponding Font resource is configured with multiple language specific parameters (so-called virtual font). In such case the default-glyphs of the several fonts are mixed together. The detection and elimination of not existing glyphs fails. The not existing glyphs are generated now referring some default glyph from the last processed font. The not existing glyphs appear in the generated code.

This behaviour is known as incorrect in EmWi. In the preparation for the next version this issue has already been fixed. The last official version 11.00 still contains the error.

Let us know if these generated glyphs are fine or could lead any issues in future.

No, I would not worry about it. Since the glyphs are not available within the original Noto Sans font trying to use them would produce text with the default glyph (e.g. some empty boxes or question marks). In your actual case, the not available glyphs are treated as 4 pixel wide blank characters. As long as your application does not use these glyphs, the text outputs are correct. When such glyphs are used, the application will display 4 pixel wide blanks wherever such glyphs appear. The expected behaviour would be to display the default glyph. This is the unique difference.

Also, could you please describe the relation between EW_FONT_PIXEL and EW_GLYPH .

EW_FONT_PIXEL contains the 'images' of all glyphs used in the font. EW_GLYPH stores the metric information for a concrete glyph referring the corresponding image within EW_FONT_PIXEL. These macros and all related structures atre documented in the file ewextfnt.h.

I hope it helps you further.

If you still have doubts concerning the font generation in your project, you can provide an example producing the above code for analysis purpose. If you are using a special version of the Noto Sans font, provide also this font for test purpose.

Best regards

Paul Banach

by
Hi Paul,

yes, you were right that the glyph were not present for certain ranges as we were using different version of Noto sans, e.g. Noto sans JP regular or something like that. Issue was resolved after using correct Noto sans version.

Thanks for the quick help!

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...