question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS: Font weight of "condensed" font is not obeyed

See original GitHub issue

When using a condensed font for an application, in our case “Acumin Pro Condensed” the font weight and styling is not obeyed when using with React Native.

React Native version:

info React Native Environment Info: System: OS: macOS 10.15.1 CPU: (8) x64 Intel® Core™ i7-4980HQ CPU @ 2.80GHz Memory: 579.14 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 11.10.0 - /usr/local/bin/node Yarn: 1.13.0 - /usr/local/bin/yarn npm: 6.7.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 IDEs: Xcode: 11.2.1/11B53 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.10 => 0.59.10 npmGlobalPackages: react-native-cli: 2.0.1

Steps To Reproduce

  1. Install custom font “Acumin Pro Condensed” to React Native project.
  2. Try using italic variant of font, using textStyle: "italic". (Or a different weight)
  3. Observe regular variant of font is used instead.

Describe what you expected to happen:

The font should be correctly rendered as italic or a different weight.

Snack, code example, screenshot, or link to a repository:

<Text style={{
    fontStyle: 'italic',
    fontFamily: 'Acumin Pro Condensed'
}}>Hello World</Text>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
simonmitchellcommented, Mar 22, 2020

Line height issues are generally just a PITA on iOS. You have to go into the font file itself and play around with the line height extender properties unfortunately @bitttttten. I can’t seem to attach font files here, but you can find a tutorial on doing this here: https://www.tothenew.com/blog/fix-vertical-position-issue-of-custom-ios-fonts/

0reactions
bittttttencommented, Mar 22, 2020

Thanks @simonmitchell ! And yeah tell me about it. On Android it looks perfect, shame it’s such an odd experience on iOS. I tried my best to edit these values as close as the article’s instructions as possible, although his formula didn’t quite work for me so I just had to do it by eye. It took almost the last hour :, )

Did you manage to fix it for Acumin Pro Condensed? If so would you mind comparing / sharing the hhea config? Don’t worry if not. I have only done Acumin Pro Condensed Bold and my values are:

<hheaTable
	versionMajor="1"
	versionMinor="0"
	ascender="760"
	descender="0"
	lineGap="0"
	advanceWidthMax="1032"
	minLeftSideBearing="-177"
	minRightSideBearing="-191"
	xMaxExtent="1000"
	caretSlopeRise="1"
	caretSlopeRun="0"
	caretOffset="0"
	metricDataFormat="0"
	numberOfHMetrics="792"
/>
Read more comments on GitHub >

github_iconTop Results From Across the Web

font-weight | Apple Developer Documentation
Specifies the font weight for the text in an element. Overview. Use the font-weight style to specify how thick or thin a font...
Read more >
Unrecognized font family on iOS simulator with React Native
Double check the font files are included in the Target in XCode; Make sure they are included in the step "Copy Bundle Resources"...
Read more >
font-face - CSS: Cascading Style Sheets - MDN Web Docs
Chrome Edge @font‑face Full support. Chrome1. Toggle history Full support... OpenType CBDT and CBLC rendering Full support. Chrome66. Toggle history Full support... OpenType COLRv0 rendering Full...
Read more >
CSS Fonts Module Level 4 - W3C
When a weight is specified for which no face exists, a face with a nearby weight is used. In general, bold weights map...
Read more >
Beginners Guide To Text Styling in Flutter - Medium
Then you declare all the fonts under the fonts property and list each version of the font using a hyphen followed by asset:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found