mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-23 04:33:09 +00:00
GRAPHICS: MACGUI: Added Header formatting, synced with stripFormatting(), fixed closing formatting
This commit is contained in:
parent
32f7eec2c6
commit
a314def2cc
@ -51,7 +51,11 @@ void render_header(Common::DataBuffer *ob, const Common::DataBuffer *text, int l
|
||||
if (!text)
|
||||
return;
|
||||
|
||||
warning("STUB: render_header(%s)", PR(text));
|
||||
debug(1, "render_header(%s)", PR(text));
|
||||
|
||||
Common::String res = Common::String::format("\016+00%01x%s\001\016-00f", level, Common::String((const char *)text->data , text->size).c_str());
|
||||
|
||||
bufput(ob, res.c_str(), res.size());
|
||||
}
|
||||
|
||||
void render_hrule(Common::DataBuffer *ob, void *opaque) {
|
||||
@ -125,7 +129,7 @@ int render_double_emphasis(Common::DataBuffer *ob, const Common::DataBuffer *tex
|
||||
|
||||
debug(1, "render_double_emphasis(%s)", PR(text));
|
||||
|
||||
Common::String res = Common::String::format("\016+%02x%s\016-%02x", kMacFontBold, Common::String((const char *)text->data , text->size).c_str(), kMacFontBold);
|
||||
Common::String res = Common::String::format("\016+%02x0%s\001\016-%02x0", kMacFontBold, Common::String((const char *)text->data , text->size).c_str(), kMacFontBold);
|
||||
|
||||
bufput(ob, res.c_str(), res.size());
|
||||
return 1;
|
||||
@ -137,7 +141,7 @@ int render_emphasis(Common::DataBuffer *ob, const Common::DataBuffer *text, void
|
||||
|
||||
debug(1, "render_emphasis(%s)", PR(text));
|
||||
|
||||
Common::String res = Common::String::format("\016+%02x%s\016-%02x", kMacFontItalic, Common::String((const char *)text->data , text->size).c_str(), kMacFontItalic);
|
||||
Common::String res = Common::String::format("\016+%02x0%s\001\016-%02x0", kMacFontItalic, Common::String((const char *)text->data , text->size).c_str(), kMacFontItalic);
|
||||
|
||||
bufput(ob, res.c_str(), res.size());
|
||||
return 1;
|
||||
@ -250,8 +254,10 @@ void MacText::setMarkdownText(const Common::U32String &str) {
|
||||
sd_markdown_render(ob, ib->data, ib->size, md);
|
||||
sd_markdown_free(md);
|
||||
|
||||
warning("%zu bytes: %s", ob->size, toPrintable(Common::String((const char *)ob->data, ob->size)).c_str());
|
||||
|
||||
setDefaultFormatting(kMacFontChicago, kMacFontChicago, 40, 0, 0, 0);
|
||||
setText(Common::String((const char *)ob->data, ob->size));
|
||||
warning("%zu bytes: %s", ob->size, Common::String((const char *)ob->data, ob->size).c_str());
|
||||
}
|
||||
|
||||
} // End of namespace Graphics
|
||||
|
@ -694,24 +694,35 @@ void MacText::splitString(const Common::U32String &str, int curLine) {
|
||||
}
|
||||
}
|
||||
|
||||
// get format
|
||||
// get format (sync with stripFormat() )
|
||||
if (*s == '\016') { // human-readable format
|
||||
s++;
|
||||
|
||||
if (*s == '-') { // \016-XX -- closing textSlant
|
||||
uint16 textSlant;
|
||||
// First two digits is slant, third digit is Header number
|
||||
if (*s == '-') { // \016-XXY -- closing textSlant, H<Y>
|
||||
uint16 textSlant, headSize;
|
||||
s++;
|
||||
|
||||
s = readHex(&textSlant, s, 2);
|
||||
|
||||
current_format.textSlant &= ~textSlant; // Clearing the specified bit
|
||||
} else if (*s == '+') { // \016+XX -- opening textSlant
|
||||
uint16 textSlant;
|
||||
|
||||
s = readHex(&headSize, s, 1);
|
||||
if (headSize == 0xf) // reset
|
||||
current_format.fontSize = _defaultFormatting.fontSize;
|
||||
} else if (*s == '+') { // \016+XXY -- opening textSlant. H<Y>
|
||||
uint16 textSlant, headSize;
|
||||
s++;
|
||||
|
||||
s = readHex(&textSlant, s, 2);
|
||||
|
||||
current_format.textSlant |= textSlant; // Setting the specified bit
|
||||
|
||||
s = readHex(&headSize, s, 1);
|
||||
if (headSize >= 1 && headSize <= 6) { // set
|
||||
const float sizes[] = { 1, 3.0f, 2.5f, 2.0f, 1.75f, 1.5f, 1.25f };
|
||||
current_format.fontSize = _defaultFormatting.fontSize * sizes[headSize];
|
||||
}
|
||||
} else {
|
||||
uint16 fontId, textSlant, fontSize, palinfo1, palinfo2, palinfo3;
|
||||
|
||||
|
@ -581,7 +581,11 @@ Common::U32String stripFormat(const Common::U32String &str) {
|
||||
tmp += *s++;
|
||||
}
|
||||
} else if (*s == '\016') { // human-readable format
|
||||
s += 23;
|
||||
s++;
|
||||
if (*s == '+' || *s == '-')
|
||||
s += 3;
|
||||
else
|
||||
s += 22;
|
||||
} else {
|
||||
tmp += *s++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user