Fix font bugs
This commit is contained in:
@@ -20,12 +20,12 @@ class Drawlist;
|
|||||||
class PD_API Font {
|
class PD_API Font {
|
||||||
public:
|
public:
|
||||||
struct Codepoint {
|
struct Codepoint {
|
||||||
u32 pCodepoint;
|
u32 pCodepoint = 0;
|
||||||
fvec4 SimpleUV;
|
fvec4 SimpleUV;
|
||||||
size_t Tex;
|
size_t Tex = 0;
|
||||||
fvec2 Size;
|
fvec2 Size;
|
||||||
float Offset = 0.f;
|
float Offset = 0.f;
|
||||||
bool pInvalid;
|
bool pInvalid = false;
|
||||||
};
|
};
|
||||||
Font() {}
|
Font() {}
|
||||||
~Font() {}
|
~Font() {}
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ PD_API fvec2 Font::GetTextBounds(const char* text, float scale) {
|
|||||||
u32 c;
|
u32 c;
|
||||||
while (it.Decode32(c)) {
|
while (it.Decode32(c)) {
|
||||||
auto cp = GetCodepoint(c);
|
auto cp = GetCodepoint(c);
|
||||||
if (!cp.pInvalid && c != '\n' && c != '\t' && c != ' ') {
|
if (cp.pInvalid && c != '\n' && c != '\t' && c != ' ') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@@ -211,10 +211,9 @@ PD_API void Font::CmdTextEx(Drawlist& dl, const fvec2& pos, u32 color,
|
|||||||
U8Iterator it(text);
|
U8Iterator it(text);
|
||||||
u32 c;
|
u32 c;
|
||||||
Command* cmd = nullptr;
|
Command* cmd = nullptr;
|
||||||
|
|
||||||
while (it.Decode32(c)) {
|
while (it.Decode32(c)) {
|
||||||
auto cp = GetCodepoint(c);
|
auto cp = GetCodepoint(c);
|
||||||
if ((!cp.pInvalid && c != '\n' && c != '\t' && c != ' ') && c != '\r')
|
if ((cp.pInvalid && c != L'\n' && c != L'\t' && c != L' ') && c != L'\r')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (c == L'\n') {
|
if (c == L'\n') {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ int main(int argc, char** argv) {
|
|||||||
while (pOs->Mainloop()) {
|
while (pOs->Mainloop()) {
|
||||||
pOs->ClearViewPort();
|
pOs->ClearViewPort();
|
||||||
PD::Li::ResetPools();
|
PD::Li::ResetPools();
|
||||||
|
pList.SetFontscale(pOs->SizeTranslate(PD::fvec2(0.0017)).x);
|
||||||
pList.PathRect(pOs->PositionTranslate(0.05), pOs->PositionTranslate(0.4f),
|
pList.PathRect(pOs->PositionTranslate(0.05), pOs->PositionTranslate(0.4f),
|
||||||
10.f);
|
10.f);
|
||||||
pList.PathFill(0xff00ffff);
|
pList.PathFill(0xff00ffff);
|
||||||
|
|||||||
Reference in New Issue
Block a user