https://github.com/aramperes/buzz4j
Java bindings for HarfBuzz
https://github.com/aramperes/buzz4j
bindings harfbuzz java jni text-shaping
Last synced: about 1 year ago
JSON representation
Java bindings for HarfBuzz
- Host: GitHub
- URL: https://github.com/aramperes/buzz4j
- Owner: aramperes
- License: mit
- Created: 2023-08-18T03:12:18.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-22T20:56:01.000Z (almost 3 years ago)
- Last Synced: 2025-02-21T14:49:41.071Z (over 1 year ago)
- Topics: bindings, harfbuzz, java, jni, text-shaping
- Language: Java
- Homepage:
- Size: 7.27 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# buzz4j
Java bindings for [HarfBuzz](https://harfbuzz.github.io).
[](./LICENSE)
[](https://github.com/aramperes/buzz4j/actions)
[](https://github.com/aramperes/buzz4j/releases/latest)
## Usage
This library only implements a tiny subset of HarfBuzz API. I focused on the use-case for my own projects:
```java
import dev.poire.buzz4j.HarfBuzz;
HarfBuzz.shapeString(fontPath, text);
```
Which gives you a list of glyph and their drawing position:
```
ShapeGlyph{
int glyphId
int advanceX
int advanceY
int offsetX
int offsetY
}[]
```
## Compile
There is a submodule for `harfbuzz`. Start by fetching the submodule sources with `git submodule update`.
Then, `cd harfbuzz` and follow the [official instructions](https://harfbuzz.github.io/building.html) (meson
recommended):
```sh
meson build --wrap-mode=default
meson compile -C build
```
The `harfbuzz/build` directory should have, at minimum:
```
src/harfbuzz.lib
src/harfbuzz.dll
subprojects/freetype-2.13.0/freetype-6.dll
subprojects/libpng-1.6.39/png16-16.dll
```
Now, back in the root directory, run tests and build a `debug` library:
```sh
./gradlew build
```
This will build a JAR in `build/libs`, but it is then recommended to build
the shared library in `release` mode for distribution:
```sh
./gradlew assembleRelease
```
The build outputs for distribution are:
```
build/libs/buzz4j-1.0-SNAPSHOT.jar
buzz4jni/build/lib/main/release/buzz4j.dll
```
Keep in mind that you will need dependencies at runtime:
```
harfbuzz.dll
freetype-6.dll
png16-16.dll
```
## License
MIT License. See `LICENSE` for details.