LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.83k stars 641 forks source link

freetype & harfbuzz binding #611

Closed NekoCaffeine closed 1 year ago

NekoCaffeine commented 3 years ago

Hi, I'd like to request an freetype & harfbuzz binding.

Describe why you need it and how you're going to use it. I am trying to implement glyph rendering, but I realized that not all languages are as simple as common ones (just rendering from left to right). Some minor languages require the use of scripts in the font to calculate the layout.

Why harfbuzz and not ICU Layout engine. https://openjdk.java.net/projects/harfbuzz/ https://openjdk.java.net/jeps/258

Related Resources: https://www.freetype.org/developer.html#source-code https://harfbuzz.github.io/ https://harfbuzz.github.io/ch12.html

A simple shaping example: https://harfbuzz.github.io/ch03s03.html

Spasi commented 2 years ago

Hey,

I've started working on this and the first step was setting up CI builds for harfbuzz & freetype. They're up...

https://github.com/LWJGL-CI/harfbuzz/actions https://github.com/LWJGL-CI/freetype/actions

...but not without issues:

I would really appreciate any contributions towards fixing the above (~especially the first one~). Contact me on the LWJGL discord server (https://discord.gg/yuKsaEguzj) if you need to discuss details.

mkalinowski2 commented 2 years ago

Hey @Spasi I prepared CI/CD for compiling harfbuzz and freetype on all platforms, I hope that it'll help :)

https://github.com/LWJGL-CI/freetype/pull/1

Spasi commented 1 year ago

LWJGL 3.2.2-snapshot+8 is now available with FreeType and HarfBuzz bindings.

Please report any issues with the FreeType/HarfBuzz interop. Also, any sample/demo contributions would be very welcome.

ws909 commented 1 year ago

@Spasi Will this remain the default behaviour? Judging by the number of git updates seen in mkalinowski’s PR, it seems like you struggled a bit getting it all working together, so I’m unsure if you’re looking to change the current behaviour.

Please report any issues with the FreeType/HarfBuzz interop. Also, any sample/demo contributions would be very welcome.

As long as I can get it running, I’ll provide some samples/demos in the near time. :) I checked the website last night, after the latest updates to lwjgl-www. The nightly version was dated to 18.12.2022, but FreeType wasn’t on the list. I hope it’s there next time I try to download it.

Spasi commented 1 year ago

@ws909 Indeed, it was a nightmare to get it working, especially making it have zero outside dependencies. I don't have a reason to change the above behavior, but I'm not going to use it either. If users think otherwise, please let me know.

One objective I have with the shared library loading mechanism in LWJGL is to allow advanced users replace LWJGL's native binaries with their own builds. There are a number of reasons they might want to do so. Right now, both FreeType and HarfBuzz bindings can be used independently and custom binaries will work. Only the "hacky" override described above is LWJGL specific, that's why it is optional by default.

I updated lwjgl3-www this morning, you should be able to see FreeType now.