Fix errors in renderer lcd
This commit is contained in:
parent
0e713f7692
commit
a7904eba3b
|
@ -77,14 +77,15 @@ public:
|
||||||
|
|
||||||
const char* p = text;
|
const char* p = text;
|
||||||
|
|
||||||
double x_lcd = x * subpixel_scale;
|
// Represent the delta in x scaled by subpixel and scale_x.
|
||||||
double start_x_lcd = x_lcd;
|
double x_delta = 0;
|
||||||
|
double start_x_lcd = x * subpixel_scale;
|
||||||
|
|
||||||
while(*p)
|
while(*p)
|
||||||
{
|
{
|
||||||
if(*p == '\n')
|
if(*p == '\n')
|
||||||
{
|
{
|
||||||
x_lcd = start_x_lcd;
|
x_delta = 0;
|
||||||
y -= height * 1.25;
|
y -= height * 1.25;
|
||||||
++p;
|
++p;
|
||||||
continue;
|
continue;
|
||||||
|
@ -95,7 +96,7 @@ public:
|
||||||
{
|
{
|
||||||
if(m_kerning)
|
if(m_kerning)
|
||||||
{
|
{
|
||||||
m_fman.add_kerning(&x_lcd, &y);
|
m_fman.add_kerning(&x_delta, &y);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fman.init_embedded_adaptors(glyph, 0, 0);
|
m_fman.init_embedded_adaptors(glyph, 0, 0);
|
||||||
|
@ -105,20 +106,20 @@ public:
|
||||||
ras.reset();
|
ras.reset();
|
||||||
m_mtx.reset();
|
m_mtx.reset();
|
||||||
m_mtx *= agg::trans_affine_scaling(1.0 / scale_x, 1);
|
m_mtx *= agg::trans_affine_scaling(1.0 / scale_x, 1);
|
||||||
m_mtx *= agg::trans_affine_translation(start_x_lcd + x_lcd / scale_x, ty);
|
m_mtx *= agg::trans_affine_translation(start_x_lcd + x_delta / scale_x, ty);
|
||||||
ras.add_path(m_trans);
|
ras.add_path(m_trans);
|
||||||
ren_solid.color(color);
|
ren_solid.color(color);
|
||||||
agg::render_scanlines(ras, sl, ren_solid);
|
agg::render_scanlines(ras, sl, ren_solid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// increment pen position
|
// increment pen position
|
||||||
x_lcd += glyph->advance_x;
|
x_delta += glyph->advance_x;
|
||||||
y += glyph->advance_y;
|
y += glyph->advance_y;
|
||||||
}
|
}
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
// Update x value befor returning.
|
// Update x value befor returning.
|
||||||
x = x_lcd / subpixel_scale;
|
x += x_delta / (scale_x * subpixel_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear(agg::rendering_buffer& ren_buf, const agg::rgba8 color) {
|
void clear(agg::rendering_buffer& ren_buf, const agg::rgba8 color) {
|
||||||
|
@ -130,7 +131,7 @@ public:
|
||||||
void render_text(agg::rendering_buffer& ren_buf,
|
void render_text(agg::rendering_buffer& ren_buf,
|
||||||
const double text_size,
|
const double text_size,
|
||||||
const agg::rgba8 text_color,
|
const agg::rgba8 text_color,
|
||||||
double x, double y,
|
double& x, double& y,
|
||||||
const char *text)
|
const char *text)
|
||||||
{
|
{
|
||||||
if (!m_font_loaded) {
|
if (!m_font_loaded) {
|
||||||
|
|
Loading…
Reference in New Issue