Skip to content

Commit af9b4b2

Browse files
committed
[Doc] Clarify information about Freetype usage
1 parent 13d4fa2 commit af9b4b2

File tree

1 file changed

+66
-4
lines changed

1 file changed

+66
-4
lines changed

README.md

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ It hides all low-level stuff under one class to extend, so you can build your GU
3333
- **Multi-Viewports/Docking Branch**<br>
3434
Binding has a full support of [Multi-Viewports](https://github.com/ocornut/imgui/wiki/Multi-Viewports) and [Docking](https://github.com/ocornut/imgui/wiki/Docking). <br>
3535
- **FreeType Font Renderer**<br>
36-
FreeType font renderer enabled by default to provide a better quality fonts.<br>
36+
FreeType font renderer provides a much better fonts quality. [See how to use](#freetype).<br>
3737
- **Extensions**<br>
3838
Binding includes several useful [extensions](https://github.com/ocornut/imgui/wiki/Useful-Widgets) for Dear ImGui. [See full list](#extensions).
3939

@@ -133,9 +133,17 @@ dependencies {
133133
Using binding without the wrapper requires to "attach" it to your application manually.
134134
You can refer to [imgui-app](https://github.com/SpaiR/imgui-java/blob/v1.82.0/imgui-app) module and see how things are done there.
135135

136-
#### Dependencies
137-
For simplicity, example of dependencies for Gradle and Maven only show how to add natives for Windows.<br>
138-
Feel free to add other platforms: `imgui-java-natives-windows-x86`, `imgui-java-natives-linux`, `imgui-java-natives-linux-x86`, `imgui-java-natives-macos`.
136+
### Dependencies
137+
For simplicity, example of dependencies for Gradle/Maven only shows how to add natives for Windows.
138+
Feel free to add other platforms.
139+
140+
| Native Binaries | System |
141+
| ------------------------------ | ------------- |
142+
| imgui-java-natives-windows-x86 | Windows 32bit |
143+
| imgui-java-natives-windows | Windows 64bit |
144+
| imgui-java-natives-linux-x86 | Linux 32bit |
145+
| imgui-java-natives-linux | Linux 64bit |
146+
| imgui-java-natives-macos | MacOS |
139147

140148
Take a note, that you also need to add dependencies to [LWJGL](https://www.lwjgl.org/). Examples below shows how to do it as well.
141149

@@ -257,6 +265,60 @@ dependencies {
257265
- [imgui-node-editor](https://github.com/thedmd/imgui-node-editor/tree/687a72f940c76cf5064e13fe55fa0408c18fcbe4) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.82.0/example/src/main/java/ExampleImGuiNodeEditor.java) <br>
258266
Node Editor using ImGui. (A bit more complex than ImNodes, but has more features.)
259267

268+
## Freetype
269+
By default, Dear ImGui uses stb-truetype to render fonts. Yet there is an option to use FreeType font renderer. Read [imgui_freetype](https://github.com/ocornut/imgui/tree/256594575d95d56dda616c544c509740e74906b4/misc/freetype) to get more info.
270+
Binding has this option too. There are two types of precompiled binaries: 1. with stb (the default one) 2. with freetype.
271+
You can decide by yourself, which kind of libraries for any system you want to use.
272+
273+
Take a not, that for Linux and Mac users using of freetype will add additional dependency to the `libfreetype` itself.
274+
This is not the case for Windows users, since `dll` files are compiled fully statically and already include freetype in themselves.
275+
276+
**For fully portable application** use default libraries. You can still use freetype binaries for Windows builds without worry.
277+
278+
**For better fonts** use freetype libraries. Don't forget to make clear for your Linux/Mac users, that they will need to install freetype on their systems as well.
279+
280+
### How To Use
281+
- Maven/Gradle:<br>
282+
Use the same native libraries as you would, but with `-ft` suffix in the end.
283+
284+
| Native Binaries With FreeType | System |
285+
| --------------------------------- | ------------- |
286+
| imgui-java-natives-windows-x86-ft | Windows 32bit |
287+
| imgui-java-natives-windows-ft | Windows 64bit |
288+
| imgui-java-natives-linux-x86-ft | Linux 32bit |
289+
| imgui-java-natives-linux-ft | Linux 64bit |
290+
| imgui-java-natives-macos-ft | MacOS |
291+
<details>
292+
<summary><b>Modified Gradle Example</b></summary>
293+
294+
```
295+
repositories {
296+
mavenCentral()
297+
}
298+
299+
ext {
300+
lwjglVersion = '3.2.3'
301+
imguiVersion = '1.82.1'
302+
}
303+
304+
dependencies {
305+
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
306+
307+
['', '-opengl', '-glfw'].each {
308+
implementation "org.lwjgl:lwjgl$it:$lwjglVersion"
309+
implementation "org.lwjgl:lwjgl$it::natives-windows"
310+
}
311+
312+
implementation "io.github.spair:imgui-java-binding:$imguiVersion"
313+
implementation "io.github.spair:imgui-java-lwjgl3:$imguiVersion"
314+
315+
// This is the main difference
316+
implementation "io.github.spair:imgui-java-natives-windows-ft:$imguiVersion"
317+
}
318+
```
319+
</details>
320+
- If you're using raw dll/so files, go to the `bin/freetype` folder and take them from there.
321+
260322
# Binding Notice
261323
Binding was made with java usage in mind. Some places of the original library were adapted for that.<br>
262324
For example, in places where in C++ you need to pass a reference value, in Java you pass primitive wrappers: `ImInt`, `ImFloat` etc.<br>

0 commit comments

Comments
 (0)