material-foundation / material-roboto-font-loader-ios

Apache License 2.0
23 stars 18 forks source link

Fallback font for roboto #12

Open gambard opened 7 years ago

gambard commented 7 years ago

Roboto does not have characters for Arabic languages. It seems that the fallback font used in this case does not care about the style used, i.e. when using medium font, it is displayed as regular font.

randallli commented 7 years ago

The version of roboto that we are using only has Latin glyphs. It falls back to the system font for individual glyphs when they are missing. They should be coming in as medium though. @shepjgoogle found a bug with fontWithSize: losing medium weight when you use the system font.

gambard commented 7 years ago

Thanks! http://crbug.com/698716 is showing the difference in weight, using Roboto and the default font. This screenshot show an Arabic test which should contains normal and medium font. No difference is visible. simulator screen shot feb 3 2017 10 28 56 am

I am not sure I understand the bug you are describing with the fontWithSize:. Does this mean that when the library fall back for the system font it looses the medium weight? I am using fontWithSize: to get the font, so it would explain the bug.

randallli commented 7 years ago

The material spec calls for bold when using tall languages. https://material.io/guidelines/style/typography.html#typography-styles We having come up with a good way to not only serve roboto with Arabic and change the weight when we do.

randallli commented 7 years ago

Can you try using bold and see if you still have the same problem?

ShepJGoogle commented 7 years ago

_titleFont = [UIFont systemFontOfSize:20 weight:UIFontWeightBold]; _titleLabel.font = [_titleFont fontWithSize:_titleFont.pointSize * scaleFactor];

The above returns San Fransisco Semi-Bold on when called bold as shown below: screen shot 2017-03-16 at 12 17 07 pm

I would recommend against using fontWithSize: on System Font

gambard commented 7 years ago

Change medium to bold was the fix I implemented, the difference was visible.

randallli commented 7 years ago

@ShepJGoogle in my tests i found that [UIFont boldSystemFontOfSize:20] would return SF Semi-Bold