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
It seems that Font:setFallbacks( ) is complicated in how it works in the background, I tested it more to see if it works perfectly with RTL languages when used together with LTR fonts. And I apologize for not testing it thoroughly the first time. The results as follows:
When RTL (Arabic for example) font used as the fallback, its words are displayed correctly, but organized wrongly from left to right and with no spaces between the words.
It's supposed to look like this "اختبار العربية".
When LTR (English for example) font used as the fallback, its words are displayed and organized correctly, but with no spaces between them.
A Third case is, if you print both texts in one string, the result will be different depending on who is the primary font or the fallback font, or who you started writing with.
This is the code, switch the order of the fonts and comment/uncomment the prints as you see fit.
locallove=require("love")
localfont=love.graphics.newFont("NotoSans-Regular.ttf", 30)
localfallback=love.graphics.newFont("NotoNaskhArabic-Regular.ttf", 30)
love.graphics.setFont(font)
font:setFallbacks(fallback)
functionlove.draw()
love.graphics.print("اختبار العربية")
love.graphics.print("Hello world")
love.graphics.print("اختبار العربية Hello world")
end
There is another problem, it happens when using love.graphics.printf. It happens with RTL (Arabic in this case) and not LTR fonts. It displays the text like this when using a big limit:
I used this code:
locallove=require("love")
localfont=love.graphics.newFont("NotoNaskhArabic-Regular.ttf", 30)
love.graphics.setFont(font)
functionlove.draw()
love.graphics.printf("اختبار العربية", 0, 0, 900, "right") -- This line will display correctly in vscodeend
Huh, there is one BIG topic about this https://faultlore.com/blah/text-hates-you/
So I guess love2d needs a big beautiful handmade font rendering framework to support this.
Or not.
The current version (LÖVE 11.4) actually has good support for font and text rendering, it also supports unicode. What is missing from the current system is support for text direction and shaping, which can be done manually. With LÖVE 12, support for HarfBuzz was added and the mentioned shortcomings should be gone, it only needs testing and fixing to make sure it's working as intended.
With LÖVE 12, support for HarfBuzz was added and the mentioned shortcomings should be gone, it only needs testing and fixing to make sure it's working as intended.
It seems that
Font:setFallbacks( )
is complicated in how it works in the background, I tested it more to see if it works perfectly with RTL languages when used together with LTR fonts. And I apologize for not testing it thoroughly the first time. The results as follows:It's supposed to look like this "اختبار العربية".
This is the code, switch the order of the fonts and comment/uncomment the prints as you see fit.
There is another problem, it happens when using
love.graphics.printf
. It happens with RTL (Arabic in this case) and not LTR fonts. It displays the text like this when using a big limit:I used this code:
The fonts here to test with.
The text was updated successfully, but these errors were encountered: