material-roboto-font-loader-ios icon indicating copy to clipboard operation
material-roboto-font-loader-ios copied to clipboard

Fallback font for roboto

Open gambard opened this issue 7 years ago • 7 comments

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.

gambard avatar Mar 06 '17 12:03 gambard

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.

randallli avatar Mar 16 '17 15:03 randallli

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.

gambard avatar Mar 16 '17 15:03 gambard

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 avatar Mar 16 '17 16:03 randallli

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

randallli avatar Mar 16 '17 16:03 randallli

_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

ShepJGoogle avatar Mar 16 '17 16:03 ShepJGoogle

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

gambard avatar Mar 16 '17 16:03 gambard

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

randallli avatar Mar 16 '17 16:03 randallli