2

How can i set font Size in pixels?

Hello, Designer send me sizes of app components. Header must be 60 pixels , but if i put font size 60, it is very big. How can i adjust it for pixels. Thank you. (IOS DEVICE)

Igor Lipin
  • 41
  • 1
  • 3
  • 1
    Possible duplicate of [Font size in pixels](https://stackoverflow.com/questions/1059101/font-size-in-pixels) – Andrii Omelchenko Jan 25 '18 at 15:55
  • https://facebook.github.io/react-native/docs/pixelratio.html#getfontscale You can try to implement this function to have more informations about the ratio for the specific phone you're using. However, i would advise you to look at lineHeight css property – Louis Lecocq Jan 25 '18 at 15:56

1 Answers1

2

You cannot do pixels on mobile. You do DPI. Tell your designer to get with the tech. He's designing for web. While you can figure out how many DPI correlate to how many pixels for the current device (its a device specific thing) with the PixelRatio API - https://facebook.github.io/react-native/docs/pixelratio.html - it's putting in effort to make your design worse. DPI works great across different screens/sizes.

Noitidart
  • 35,443
  • 37
  • 154
  • 323