Skip to content

myopic-design/defold-fontscale

Repository files navigation

Defold FontScale logo

Actions Status

Defold FontScale

Defold native extension that returns the preferred font scaling factor on the device.

  • On Android, users can set the font scaling factor via Settings > Display > Display size & text.
  • On iOS, users can set the font scaling factor via Settings > Display and Brightness > Text Size, or via Settings > Accessibility > Display & Text Size > Larger Text.
Android iOS
Setting the font scaling factor on Android Setting the font scaling factor on iOS

Platform support

Defold FontScale currently supports Android and iOS. On all other platforms, it'll return 1.0.

Contributions are welcome!

Installation

You can use Defold FontScale by adding it as a library dependency in your project:

Usage

Get the font scaling factor with fontscale.get(), and then apply it to whatever nodes you want:

if fontscale then
  local scale = fontscale.get()
  go.set("#label", "scale", vmath.vector3(scale, scale, 0))
end