Skip to content

A text layout differs between android and ios when using external font #21021

Closed
@masarusanjp

Description

@masarusanjp

Environment

Run react-native info in your terminal and paste its contents here.

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
      Memory: 25.59 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.1.0 - /usr/local/bin/node
      Yarn: 1.6.0 - /usr/local/bin/yarn
      npm: 5.6.0 - /usr/local/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
      Android SDK:
        Build Tools: 23.0.1, 26.0.3, 27.0.3, 28.0.1
        API Levels: 23, 26, 28
    IDEs:
      Android Studio: 3.1 AI-173.4819257
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.4.1 => 16.4.1 
      react-native: 0.56.0 => 0.56.0 
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1

Description

When I set 'Tsukushi A Round Gothic' as the fontFamily of a Text component, the layout differs between android and ios.

screenshots

android iOS

The difference occurs since 'Tsukushi A Round Gothic' has a leading(a line gap. see this)
iOS doesn’t ignore leading, but android ignores it.

This difference causes the following two problems.

  • It is difficult to use for UI on iOS
  • Layout differs between android and ios

It is not limited to Tsukushi A Round Gothic. The same problem also occurs in Hiragino which is the standard iOS font.

Reproducible Demo

https://drive.google.com/open?id=1jI53RiQRUbEGtotn8BrIrj3RvyNgSpZR

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions