Repository navigation
Conversation
| */ | ||
| std::string getCurrentLocale(); | ||
|
|
||
| #ifdef __SWITCH__ |
There was a problem hiding this comment.
Why put it here? Technically it's i18n related but it doesn't belong to the i18n system
There was a problem hiding this comment.
I mean it depends on the Switch implementation, and i18n is supposed to be generic (and eventually will)
There was a problem hiding this comment.
this id only make sense for libnx i think
removed #ifdef
| Logger::warning("Non applet mode, font full fallback is enabled!"); | ||
| } | ||
|
|
||
| if (locale == 6 || locale == 15 || isFullFallback) |
There was a problem hiding this comment.
Not a fan of magic values here, could you define them somewhere instead?
There was a problem hiding this comment.
substituted with enforcing SetLanguage enum
| if (at == AppletType_Application || at == AppletType_SystemApplication) // title takeover | ||
| { | ||
| isFullFallback = true; | ||
| Logger::warning("Non applet mode, font full fallback is enabled!"); |
| } | ||
| else | ||
| { | ||
| brls::Logger::error("Unable to convert system language ID (error 0x{0:x}), using the default one: {1}", res, DEFAULT_LOCALE); |
There was a problem hiding this comment.
You can use {0:#x} instead of 0x{0x:}
|
Thanks for the PR!
I am going to wait for you to add proper names to the locale magic values since I am having a real hard time to understand the second part of the code without it. |
| Logger::info("Using Switch shared font"); | ||
| Application::fontStash.regular = Application::loadFontFromMemory("regular", font.address, font.size, false); | ||
| Logger::info("Adding Switch shared standard font"); | ||
| Application::fontStash.standard = Application::loadFontFromMemory("regular", font.address, font.size, false); |
There was a problem hiding this comment.
Wouldn't that be standard as well in the loadFontFromMemory call?
|
I am very sorry but I am currently rewriting the entirety of font handling for the yoga rework (yoga branch, my work is not pushed yet). I am currently adapting Behemoth's work of splitting borealis in two "platforms", glfw and switch. That means the Switch will have its own font loading code, which is no longer in Would you mind redoing what you did on the yoga branch once I push what I have? I will notify you here. The core of what you did will not be altered, you will just need to put it in the new font code dedicated to the Switch platform. |
|
i'm okay with that
|
|
Hey @CaiMiao, I finished working on the new font abstraction layer. It's on the yoga branch, feel free to PR to that branch if you want to. Now fonts are defined in a fully platform agnostic file, and every platform implementation loads them as they wish. The fallback code is still in |
|
have problem with building demo |
|
It looks like your |
I'm compiling the demo under the yoga branch, and everything is unmodified, so i don't really know where I did wrong. |
|
Can you try again with the changes of this commit please? |
this works for me, ty. once i tested the implement okay i will PR them again asap. |
|
replaced by #79 |
|
well i think it is not bad to merge this to legacy though, in case anyone need to include the shared font workaround without need to update to yoga. |
|
The thing is, I don't want to maintain this version anymore. The yoga rework is too hard to rebase since so many things changed 😕 |
This is similar to #49 but I made a more graceful implement (at least imo), and I didn't aware of #49 when I was writing this lol
For memory consuming concern, we do not load full fallback chain when we are not in title takeover mode.
Confirmed working for my WIP tiny tool.
I'm not really a programmer so let me know if cleanup/optimization is needed.
Still I have a question, I can't really figure out how
nvgAddFallbackFontIdpush the fallback order so I may have reversed my intend.For example:
does make the order
regular->korean->symbol(appending) orregular->symbol->korean(prepending)?