Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-10T04:15:43.000Z (5 months ago)
- Last Synced: 2024-09-10T07:01:36.046Z (5 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
![Defold FontScale logo](docs/[email protected])
[![Actions Status](https://github.com/myopic-design/defold-fontscale/actions/workflows/bob.yml/badge.svg)](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 |
| :----------------------------------------------------------------: | :--------------------------------------------------------: |
| ![Setting the font scaling factor on Android](docs/[email protected]) | ![Setting the font scaling factor on iOS](docs/[email protected]) |## 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
```