font: drop tags that don't fit in buf

main
Dominik Madarász 2024-02-08 15:37:49 +01:00
parent bea30c6e12
commit 65b57039a2
4 changed files with 4 additions and 10 deletions

View File

@ -140,7 +140,7 @@ int main() {
{ {
vec2 pos = vec2(1990,820); vec2 pos = vec2(1990,820);
ddraw_push_2d(); ddraw_push_2d();
char *txt = FONT_RIGHT FONT_BOTTOM FONT_WHITE "This is the first line.\n" FONT_LIME "And now the second line.\n" FONT_WHITE "You can do a third great line, too!\n"; char *txt = FONT_RIGHT FONT_BOTTOM FONT_WHITE "This is the first line.\n" FONT_LIME "And now the second line.\n" FONT_WHITE "You can do a third" FONT_ORANGE " great" FONT_WHITE " line, too!\n";
font_goto(pos.x, pos.y); font_goto(pos.x, pos.y);
vec2 size=font_rect(txt); vec2 size=font_rect(txt);
font_metrics_t m=font_metrics(txt); font_metrics_t m=font_metrics(txt);

View File

@ -363964,12 +363964,10 @@ vec2 font_print_rect(const char *text, vec4 rect) {
if( (ch >= 1 && ch <= 6) || if( (ch >= 1 && ch <= 6) ||
(ch >= 0x1a && ch <= 0x1f) || (ch >= 0x1a && ch <= 0x1f) ||
(ch >= 0x10 && ch <= 0x19)) { (ch >= 0x10 && ch <= 0x19)) {
tags[t++] = ch; if (t < sizeof(tags)) tags[t++] = ch;
} }
else break; else break;
++text; ++text;
if (t == 3) break;
} }
array(char *) lines = strsplit(text, "\n"); array(char *) lines = strsplit(text, "\n");
if (b) { if (b) {

View File

@ -2406,12 +2406,10 @@ vec2 font_print_rect(const char *text, vec4 rect) {
if( (ch >= 1 && ch <= 6) || if( (ch >= 1 && ch <= 6) ||
(ch >= 0x1a && ch <= 0x1f) || (ch >= 0x1a && ch <= 0x1f) ||
(ch >= 0x10 && ch <= 0x19)) { (ch >= 0x10 && ch <= 0x19)) {
tags[t++] = ch; if (t < sizeof(tags)) tags[t++] = ch;
} }
else break; else break;
++text; ++text;
if (t == 3) break;
} }
array(char *) lines = strsplit(text, "\n"); array(char *) lines = strsplit(text, "\n");
if (b) { if (b) {

View File

@ -11104,12 +11104,10 @@ vec2 font_print_rect(const char *text, vec4 rect) {
if( (ch >= 1 && ch <= 6) || if( (ch >= 1 && ch <= 6) ||
(ch >= 0x1a && ch <= 0x1f) || (ch >= 0x1a && ch <= 0x1f) ||
(ch >= 0x10 && ch <= 0x19)) { (ch >= 0x10 && ch <= 0x19)) {
tags[t++] = ch; if (t < sizeof(tags)) tags[t++] = ch;
} }
else break; else break;
++text; ++text;
if (t == 3) break;
} }
array(char *) lines = strsplit(text, "\n"); array(char *) lines = strsplit(text, "\n");
if (b) { if (b) {