Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to use fonts installed on the system #898

Merged
merged 4 commits into from Nov 10, 2023

Conversation

MatkovIvan
Copy link
Member

@MatkovIvan MatkovIvan commented Nov 9, 2023

Proposed Changes

  • Add SystemFont class to be able to use fonts installed on the system.

API Change

+androidx.compose.ui.text.platform.SystemFont

Testing

Usage looks like this:

FontFamily(SystemFont("Menlo")),
FontFamily(SystemFont("Times New Roman", FontWeight.Bold)),
FontFamily(SystemFont("Webdings")),
Screenshot 2023-11-09 at 12 18 02

@MatkovIvan MatkovIvan merged commit 8701e31 into jb-main Nov 10, 2023
3 checks passed
@MatkovIvan MatkovIvan deleted the ivan.matkov/system-font branch November 10, 2023 17:56
MatkovIvan added a commit that referenced this pull request Nov 13, 2023
## Proposed Changes

- Fixes JS build after #898
- Does **NOT** fix fonts in JS
(JetBrains/compose-multiplatform#3915), so
it's compilation only fix.
mazunin-v-jb pushed a commit that referenced this pull request Dec 7, 2023
## Proposed Changes

- Add `SystemFont` class to be able to use fonts installed on the
system.

## API Change

```diff
+androidx.compose.ui.text.platform.SystemFont
```

## Testing

Usage looks like this:
```kt
FontFamily(SystemFont("Menlo")),
FontFamily(SystemFont("Times New Roman", FontWeight.Bold)),
FontFamily(SystemFont("Webdings")),
```
<img width="1003" alt="Screenshot 2023-11-09 at 12 18 02"
src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/0c36d4aa-6bc9-47e2-94dd-edb09fd242ac">
mazunin-v-jb pushed a commit that referenced this pull request Dec 7, 2023
## Proposed Changes

- Fixes JS build after #898
- Does **NOT** fix fonts in JS
(JetBrains/compose-multiplatform#3915), so
it's compilation only fix.
MatkovIvan added a commit that referenced this pull request Jan 23, 2024
## Proposed Changes

- Missing piece of #898
- It's a copy-paste of already existing code.

## Testing

Test: try to use `SystemFont` on iOS

```kt
FontFamily(SystemFont("Helvetica")),
FontFamily(SystemFont("Times New Roman")),
FontFamily(SystemFont("Courier")),
```

![Simulator Screenshot - iPhone 15 Pro - 2024-01-23 at 14 02
50](https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/56738d38-41fd-40c1-9408-0f3cacb38a2d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants