Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adrientetar/kotlin-ufo
A library to read/write UFO fonts on the JVM.
https://github.com/adrientetar/kotlin-ufo
fonts kotlin-jvm
Last synced: 9 days ago
JSON representation
A library to read/write UFO fonts on the JVM.
- Host: GitHub
- URL: https://github.com/adrientetar/kotlin-ufo
- Owner: adrientetar
- License: apache-2.0
- Created: 2023-05-29T15:54:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-26T21:53:49.000Z (9 months ago)
- Last Synced: 2024-02-26T22:57:55.959Z (9 months ago)
- Topics: fonts, kotlin-jvm
- Language: Kotlin
- Homepage:
- Size: 101 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
kotlin-ufo
==========**A library to read/write [UFO fonts]**
[![Kotlin](https://img.shields.io/badge/Language-Kotlin-7f52ff.svg)](https://kotlinlang.org/)
[![Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE.txt)
[![Code coverage](https://codecov.io/gh/adrientetar/kotlin-ufo/branch/main/graph/badge.svg?token=6VLVM9MTQM)](https://codecov.io/gh/adrientetar/kotlin-ufo)With this library, one can generate [UFO fonts], which in turn allows using the [fontmake] compiler.
This project is currently in very early stage and cannot be used to make fonts. Only UFO 3 is
supported.- Font info β
- Foreground layer glyphs β
- Font lib β
- Remaining: other layers, features, groups/kerning, other libs, data...Usage
-----### Read
```kotlin
import com.google.common.truth.Truth.assertThat
import dev.adrientetar.kotlin.ufo.UFOReader
import java.nio.file.Pathsval path = Paths.get("/usr/share/MyFont-Regular.ufo")
val reader = UFOReader(path)
val info = reader.readFontInfo()assertThat(info.familyName).isEqualTo("My Font")
assertThat(info.styleName).isEqualTo("Regular")
```### Write
```kotlin
import dev.adrientetar.kotlin.ufo.FontInfoValues
import dev.adrientetar.kotlin.ufo.UFOWriter
import java.nio.file.Pathsval path = Paths.get("/usr/share/MyFont-Regular.ufo")
val info = FontInfoValues().apply {
familyName = "My Font"
styleName = "Regular"
}val writer = UFOWriter(path)
writer.writeFontInfo(info)
```See [the tests](/src/test/kotlin/dev/adrientetar/kotlin/ufo) for more sample code.
Contributions
-------------I would like to have help with the following:
- Adding support to read/write more things (with tests π)
- Writing tests: we can port some tests from [fontTools.ufoLib], and write to a
[virtual filesystem][jimfs] to keep the tests fast to run.
- Adding a pipeline to [validate exported API][binary-compatibility-validator], so that we donβt
export unintended symbols in the library and can monitor backwards incompatible changes.If you want to make a non-trivial contribution, consider coordinating with me and sharing design
details beforehand if applicable. Thanks![UFO fonts]: https://unifiedfontobject.org/
[binary-compatibility-validator]: https://github.com/Kotlin/binary-compatibility-validator
[fontTools.ufoLib]: https://github.com/fonttools/fonttools/blob/main/Tests/ufoLib/UFO3_test.py
[fontmake]: https://github.com/googlefonts/fontmake
[jimfs]: https://github.com/google/jimfs