https://github.com/myopic-design/defold-fontscale
Defold native extension that returns the preferred font scaling factor on the device.
https://github.com/myopic-design/defold-fontscale
Last synced: 4 months ago
JSON representation
Defold native extension that returns the preferred font scaling factor on the device.
- Host: GitHub
- URL: https://github.com/myopic-design/defold-fontscale
- Owner: myopic-design
- License: mit
- Created: 2023-09-06T22:56:38.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-24T04:27:54.000Z (8 months ago)
- Last Synced: 2024-10-24T21:58:44.785Z (8 months ago)
- Language: C++
- Homepage:
- Size: 201 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-defold - FontScale
README

[](https://github.com/myopic-design/defold-fontscale/actions)
# Defold FontScale
Defold [native extension](https://www.defold.com/manuals/extensions/) 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 |
| :----------------------------------------------------------------: | :--------------------------------------------------------: |
|  |  |## 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](https://defold.com/manuals/libraries/#setting-up-library-dependencies) in your project:
- Use a specific version for development and release to avoid breaking changes: https://github.com/myopic-design/defold-fontscale/releases
- Use the latest version only while evaluating and testing the asset: https://github.com/myopic-design/defold-fontscale/archive/master.zip.## Usage
Get the font scaling factor with `fontscale.get()`, and then apply it to whatever nodes you want:
```lua
if fontscale then
local scale = fontscale.get()
go.set("#label", "scale", vmath.vector3(scale, scale, 0))
end
```