Closed CaiMiao closed 3 years ago
Thanks for the PR!
nvgAddFallbackFontId
works by appending the fallback, so the order would be regular then Korean then shared symbols.
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.
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 application.cpp
. The loading logic will be different too - everything will be abstracted away from the Switch definitions.
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 application.cpp
but the font loading has been moved to glfw_font.cpp
and switch_font.cpp
.
have problem with building demo
massive <command-line>: warning: missing terminating " character
and some errors deny me from building (not only from this file)
<command-line>: error: missing terminating " character
<command-line>: note: in definition of macro 'BRLS_RESOURCES'
C:/src/msys64/home/CaiMiao/borealis/library/lib/core/font.cpp:25:29: note: in expansion of macro 'BRLS_ASSET'
25 | #define MATERIAL_ICONS_PATH BRLS_ASSET("material/MaterialIcons-Regular.ttf")
| ^~~~~~~~~~
C:/src/msys64/home/CaiMiao/borealis/library/lib/core/font.cpp:51:56: note: in expansion of macro 'MATERIAL_ICONS_PATH'
51 | return this->loadFontFromFile(FONT_MATERIAL_ICONS, MATERIAL_ICONS_PATH);
| ^~~~~~~~~~~~~~~~~~~
make[1]: *** [/opt/devkitpro/devkitA64/base_rules:14:font.o] 错误 1
make: *** [Makefile:186:all] 错误 2
It looks like your BRLS_RESOURCES
define is wrong, it's missing a quote
It looks like your
BRLS_RESOURCES
define is wrong, it's missing a quote
I'm compiling the demo under the yoga branch, and everything is unmodified, so i don't really know where I did wrong.
can only see CXXFLAGS := $(CXXFLAGS) -DYG_ENABLE_EVENTS -fdata-sections -DBRLS_RESOURCES="\"romfs:/\""
in borealis.mk
Can you try again with the changes of this commit please?
https://github.com/natinusala/borealis/commit/6ea9f96f3366478eef746b332f63a35e8db020ac
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
nvgAddFallbackFontId
push the fallback order so I may have reversed my intend.For example:
does make the order
regular
->korean
->symbol
(appending) orregular
->symbol
->korean
(prepending)?