mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-09 18:40:18 +00:00
Update GetStringPixelWidth() to return more accurate pixel length
This commit is contained in:
parent
d74471b569
commit
49fd18afab
1 changed files with 6 additions and 5 deletions
|
@ -502,8 +502,9 @@ struct FontManager {
|
||||||
adjust = glyph->size.x;
|
adjust = glyph->size.x;
|
||||||
if (glyph->bearing.x > 0 && (glyph->size.x + glyph->bearing.x) > adjust)
|
if (glyph->bearing.x > 0 && (glyph->size.x + glyph->bearing.x) > adjust)
|
||||||
adjust = glyph->size.x + glyph->bearing.x;
|
adjust = glyph->size.x + glyph->bearing.x;
|
||||||
|
if (glyph->bearing.x < 0)
|
||||||
width = (width - glyph->advanceWidth) + adjust;
|
adjust += -glyph->bearing.x;
|
||||||
|
width = width - glyph->advanceWidth + adjust;
|
||||||
}
|
}
|
||||||
|
|
||||||
return width;
|
return width;
|
||||||
|
@ -1373,12 +1374,12 @@ void sub__UPrintString(int32_t start_x, int32_t start_y, const qbs *text, int32_
|
||||||
for (pen.x = 0; pen.x < strPixSize.x; pen.x++) {
|
for (pen.x = 0; pen.x < strPixSize.x; pen.x++) {
|
||||||
d = *alphaSrc++;
|
d = *alphaSrc++;
|
||||||
d = 255 - d;
|
d = 255 - d;
|
||||||
d /= 255.0;
|
d /= 255.0f;
|
||||||
|
|
||||||
float alpha3 = alpha1 + da * d;
|
float alpha3 = alpha1 + da * d;
|
||||||
d *= cw;
|
d *= cw;
|
||||||
if (d > 1.0)
|
if (d > 1.0f)
|
||||||
d = 1.0;
|
d = 1.0f;
|
||||||
float r3 = r1 + dr * d;
|
float r3 = r1 + dr * d;
|
||||||
float g3 = g1 + dg * d;
|
float g3 = g1 + dg * d;
|
||||||
float b3 = b1 + db * d;
|
float b3 = b1 + db * d;
|
||||||
|
|
Loading…
Reference in a new issue