You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SDL_ttf render correctly many languages, but for a few others there are troubles : wrong glyphs, inversed characters, bad positioning.
For instance, all this languages render incorrectly: arabic, bengali, burmese, hindi, kannada, khmer, lao, malayalam, marathi, nepali, persian, sinhala, tamil, telugu, thai.
The issue is that SDL_tff library has to process the string before rendering it, in order to do things like "typographic ligature" and "contextual pattern substitutions".
Those rules are stored in the font ".ttf" file, in the GSUB table (http://partners.adobe.com/public/developer/opentype/index_table_formats1.html), this quite difficult to decode and also to apply.
That's what HarfBuzz does (among other things).
The patch is not meant to be merged because it adds a new dependency that may not be wanted. But, if you plan to render some of the previous languages, you definitely need it.
I have tried ~70 languages, on Linux + Android with success.
On 2015-06-30 17:19:03 +0000, Sylvain wrote:
Created attachment 2208
SDL_ttf.c + HarfBuzz
On 2015-06-30 17:20:03 +0000, Sylvain wrote:
Created attachment 2209
Two new APIs to choose the rendering direction + script
On 2015-06-30 17:20:43 +0000, Sylvain wrote:
Created attachment 2210
compilation file for Android
Once you have downloaded the source of HarfBuzz, you need to configure it not to add extra dependencies:
ie: ./configure --with-icu=no --with-cairo=no --with-glib=no --with-gobject=no
Plus, you need to call "make" once, even if it fails (e.g. on android), so that it generates some internal state machine/automate.
On 2015-08-18 20:11:37 +0000, Sylvain wrote:
Created attachment 2247
Android.mk for HarfBuzz
Android.mk used to compile HarfBuzz on Android
On 2019-04-02 08:07:49 +0000, Sylvain wrote:
Created attachment 3722
SDL_ttf.c + HarfBuzz
Update to use HarfBuzz with latest SDL_ttf.c
On 2019-04-02 08:08:21 +0000, Sylvain wrote:
Created attachment 3723
SDL_ttf.h + HarfBuzz
On 2019-04-02 08:10:22 +0000, Sylvain wrote:
Created attachment 3724
Android.mk for HarfBuzz 2.3.1
This is the Android.mk to use for Harfbuzz 2.3.1
On 2019-04-02 08:11:11 +0000, Sylvain wrote:
Created attachment 3725
Android.mk for HarfBuzz 2.3.1
mark previous ones as obsolete
On 2019-04-02 08:12:55 +0000, Sylvain wrote:
Created attachment 3726
Modified Android.mk for SDL_ttf
On 2019-04-04 21:36:03 +0000, Sam Lantinga wrote:
Is it possible to make this a configure option (disabled by default) so we can merge this and make it an option for people?
On 2019-04-05 07:46:40 +0000, Sylvain wrote:
Ok, I'll add this.
So with the source package external/harfbuzz-2.3.1
and a setting in Android.mk to be able to build
On 2019-08-29 09:23:10 +0000, Rene Dudfield wrote:
Hello. Thanks!
We (pygame) are very interested in this, as a lot of users have requested this feature. The pygame issue is here for anyone interested in following along: pygame/pygame#464
On 2019-08-29 10:29:20 +0000, Sylvain wrote:
Hello,
You just need the latest head source of SDL_ttf, and compiles with TTF_USE_HARFBUZZ or SUPPORT_HARFBUZZ for Android.
Then pick the right font, set script var (I think sometimes it helps), and renders text. The code is tested on Android, IOS, MacosX, Linux, Windows 10. You maybe need to update your build configuration.
On 2019-08-29 11:27:47 +0000, Rene Dudfield wrote:
Hello. Thanks for the tips. Some very nice changes coming up in SDL_ttf indeed.
What do you mean by "set script var"?
On 2019-08-29 11:53:01 +0000, Sylvain wrote:
I meant TTF_SetScript() to tell harfbuzz the language/script.
On 2019-08-29 12:04:21 +0000, Rene Dudfield wrote:
Ah yes.
How does a user know which script to set for a font?
On 2019-08-29 13:10:35 +0000, Sylvain wrote:
Because of the language he want to write. See harfbuzz doc for scripts.
He also has to choose his fonts, because not all fonts render all languages.
I think HB also has a function to auto detect script.
On 2020-07-28 20:02:30 +0000, Mehdi Sadeghi wrote:
While trying to add RTL to INSTEAD game engine I came across this patch. Since Sylvain has already made a patch and Sam showed the green light for merging it as an option, is there any chance to move this forward?
Would you mind pointing me to the right compile procedure to get the latest SDL_ttf compiled for Linux desktop (not Android) with HarfBuzz support included?
I was initially able to compile SDL_ttf with your patch from here (https://discourse.libsdl.org/t/sdl-for-farsi-or-persian-text/25292/7) and by calling TTF_SetDirection( HB_DIRECTION_RTL ) and TTF_SetScript(HB_SCRIPT_ARABIC), and using a ttf font such as DejaVuSans.ttf I could see proper rendered text.
However, with the latest changes, no matter what I do I get boxes again. Probably I have messed up things when fighting with cmake and make to enable the feature. The program compiles though, so it means the functions are there but have no effect.
Thanks in advance for any tips.
On 2020-07-29 12:31:26 +0000, Sylvain wrote:
Edit the SDL_ttf.c source and set TTF_USE_HARFBUZZ to 1, or define it from upper level.
Compile with configure for instance. you need to also provide include and library path to harfbuzz.
On 2020-07-29 12:31:46 +0000, Sylvain wrote:
you still need TTF_SetDirection( HB_DIRECTION_RTL ) and TTF_SetScript(HB_SCRIPT_ARABIC),
On 2020-07-29 21:16:35 +0000, Mehdi Sadeghi wrote:
(In reply to Sylvain from comment # 23)
Edit the SDL_ttf.c source and set TTF_USE_HARFBUZZ to 1, or define it from
upper level.
Compile with configure for instance. you need to also provide include and
library path to harfbuzz.
sorry, it was my fault. The font in my program was pointing to a wrong file. I changed the SDL_ttf.c and it worked like charm. However, I was unable to set it via configure. Is there any specific configure flag for it? I searched the autotools source files and even tried to define the variable using AC_DEFINE to no avail.
On 2020-07-30 12:43:17 +0000, Sylvain wrote:
sorry there was no configure modification.
though you can set some CFLAGS environment variable to set the TTF_USE_HARFBUZZ define.
Fell free to submit a patch so it can be enable with configure, but sync with Sam about the usual way to do it.
On 2021-02-01 19:41:02 +0000, Mehdi Sadeghi wrote:
I though I'll let you know that this change is now included in the emscripten-core by default, i.e. TTF_USE_HARFBUZZ is set to 1. Providing -s USE_SDL_TTF=2 when compiling should be enough to compile C code to WASM with HarfBuzz support.
This bug report was migrated from our old Bugzilla tracker.
These attachments are available in the static archive:
SDL_ttf.c + HarfBuzz (SDL_ttf.c, text/x-csrc, 2015-06-30 17:19:03 +0000, 70743 bytes)Two new APIs to choose the rendering direction + script (SDL_ttf.h, text/x-chdr, 2015-06-30 17:20:03 +0000, 12028 bytes)compilation file for Android (Android.mk, text/x-makefile, 2015-06-30 17:20:43 +0000, 708 bytes)Android.mk for HarfBuzz (Android.mk__HarfBuzz, text/x-matlab, 2015-08-18 20:11:37 +0000, 3393 bytes)Android.mk for HarfBuzz 2.3.1 (Android.mk__HarfBuzz, text/x-matlab, 2019-04-02 08:10:22 +0000, 3827 bytes)Reported in version: unspecified
Reported for operating system, platform: Linux, x86_64
Comments on the original bug report:
On 2015-06-30 17:18:34 +0000, Sylvain wrote:
On 2015-06-30 17:19:03 +0000, Sylvain wrote:
On 2015-06-30 17:20:03 +0000, Sylvain wrote:
On 2015-06-30 17:20:43 +0000, Sylvain wrote:
On 2015-06-30 17:24:58 +0000, Sylvain wrote:
On 2015-08-18 20:11:37 +0000, Sylvain wrote:
On 2019-04-02 08:07:49 +0000, Sylvain wrote:
On 2019-04-02 08:08:21 +0000, Sylvain wrote:
On 2019-04-02 08:10:22 +0000, Sylvain wrote:
On 2019-04-02 08:11:11 +0000, Sylvain wrote:
On 2019-04-02 08:12:55 +0000, Sylvain wrote:
On 2019-04-04 21:36:03 +0000, Sam Lantinga wrote:
On 2019-04-05 07:46:40 +0000, Sylvain wrote:
On 2019-04-05 13:44:27 +0000, Sylvain wrote:
On 2019-08-29 09:23:10 +0000, Rene Dudfield wrote:
On 2019-08-29 10:29:20 +0000, Sylvain wrote:
On 2019-08-29 11:27:47 +0000, Rene Dudfield wrote:
On 2019-08-29 11:53:01 +0000, Sylvain wrote:
On 2019-08-29 12:04:21 +0000, Rene Dudfield wrote:
On 2019-08-29 13:10:35 +0000, Sylvain wrote:
On 2020-07-28 20:02:30 +0000, Mehdi Sadeghi wrote:
On 2020-07-28 21:25:20 +0000, Sylvain wrote:
On 2020-07-29 12:22:51 +0000, Mehdi Sadeghi wrote:
On 2020-07-29 12:31:26 +0000, Sylvain wrote:
On 2020-07-29 12:31:46 +0000, Sylvain wrote:
On 2020-07-29 21:16:35 +0000, Mehdi Sadeghi wrote:
On 2020-07-30 12:43:17 +0000, Sylvain wrote:
On 2021-02-01 19:41:02 +0000, Mehdi Sadeghi wrote:
On 2021-02-02 07:15:35 +0000, Sylvain wrote:
The text was updated successfully, but these errors were encountered: