Mercurial > mplayer.hg
comparison libass/ass_render.c @ 22259:cb409839a110
Correct implementation of text spacing.
author | eugeni |
---|---|
date | Mon, 19 Feb 2007 18:01:49 +0000 |
parents | 9c1160622400 |
children | ae6fe8a910dd |
comparison
equal
deleted
inserted
replaced
22258:9c1160622400 | 22259:cb409839a110 |
---|---|
148 } evt_type; | 148 } evt_type; |
149 int pos_x, pos_y; // position | 149 int pos_x, pos_y; // position |
150 int org_x, org_y; // origin | 150 int org_x, org_y; // origin |
151 char have_origin; // origin is explicitly defined; if 0, get_base_point() is used | 151 char have_origin; // origin is explicitly defined; if 0, get_base_point() is used |
152 double scale_x, scale_y; | 152 double scale_x, scale_y; |
153 int hspacing; // distance between letters, in pixels | 153 double hspacing; // distance between letters, in pixels |
154 double border; // outline width | 154 double border; // outline width |
155 uint32_t c[4]; // colors(Primary, Secondary, so on) in RGBA | 155 uint32_t c[4]; // colors(Primary, Secondary, so on) in RGBA |
156 int clip_x0, clip_y0, clip_x1, clip_y1; | 156 int clip_x0, clip_y0, clip_x1, clip_y1; |
157 char detect_collisions; | 157 char detect_collisions; |
158 uint32_t fade; // alpha from \fad | 158 uint32_t fade; // alpha from \fad |
711 render_context.scale_y = (val - 1.) * pwr + 1.; | 711 render_context.scale_y = (val - 1.) * pwr + 1.; |
712 } else | 712 } else |
713 render_context.scale_y = render_context.style->ScaleY; | 713 render_context.scale_y = render_context.style->ScaleY; |
714 } | 714 } |
715 } else if (mystrcmp(&p, "fsp")) { | 715 } else if (mystrcmp(&p, "fsp")) { |
716 int val; | 716 double val; |
717 if (mystrtoi(&p, 10, &val)) | 717 if (mystrtod(&p, &val)) |
718 render_context.hspacing = val * pwr; | 718 render_context.hspacing = render_context.hspacing * ( 1 - pwr ) + val * pwr; |
719 else | 719 else |
720 render_context.hspacing = 0; | 720 render_context.hspacing = render_context.style->Spacing; |
721 } else if (mystrcmp(&p, "fs")) { | 721 } else if (mystrcmp(&p, "fs")) { |
722 int val; | 722 int val; |
723 if (mystrtoi(&p, 10, &val)) | 723 if (mystrtoi(&p, 10, &val)) |
724 val = render_context.font_size * ( 1 - pwr ) + val * pwr; | 724 val = render_context.font_size * ( 1 - pwr ) + val * pwr; |
725 else | 725 else |
1156 update_font(); | 1156 update_font(); |
1157 | 1157 |
1158 change_border(-1.); | 1158 change_border(-1.); |
1159 render_context.scale_x = render_context.style->ScaleX; | 1159 render_context.scale_x = render_context.style->ScaleX; |
1160 render_context.scale_y = render_context.style->ScaleY; | 1160 render_context.scale_y = render_context.style->ScaleY; |
1161 render_context.hspacing = 0; // FIXME | 1161 render_context.hspacing = render_context.style->Spacing; |
1162 render_context.be = 0; | 1162 render_context.be = 0; |
1163 render_context.shadow = render_context.style->Shadow; | 1163 render_context.shadow = render_context.style->Shadow; |
1164 render_context.frx = render_context.fry = 0.; | 1164 render_context.frx = render_context.fry = 0.; |
1165 render_context.frz = M_PI * render_context.style->Angle / 180.; | 1165 render_context.frz = M_PI * render_context.style->Angle / 180.; |
1166 | 1166 |
1709 | 1709 |
1710 text_info.glyphs[text_info.length].pos.x = d6_to_int(pen.x); | 1710 text_info.glyphs[text_info.length].pos.x = d6_to_int(pen.x); |
1711 text_info.glyphs[text_info.length].pos.y = d6_to_int(pen.y); | 1711 text_info.glyphs[text_info.length].pos.y = d6_to_int(pen.y); |
1712 | 1712 |
1713 pen.x += text_info.glyphs[text_info.length].advance.x; | 1713 pen.x += text_info.glyphs[text_info.length].advance.x; |
1714 pen.x += render_context.hspacing; | 1714 pen.x += double_to_d6(render_context.hspacing); |
1715 pen.y += text_info.glyphs[text_info.length].advance.y; | 1715 pen.y += text_info.glyphs[text_info.length].advance.y; |
1716 | 1716 |
1717 // if it's an outline glyph, we still need to fill the bbox | 1717 // if it's an outline glyph, we still need to fill the bbox |
1718 if (text_info.glyphs[text_info.length].glyph) { | 1718 if (text_info.glyphs[text_info.length].glyph) { |
1719 FT_Glyph_Get_CBox( text_info.glyphs[text_info.length].glyph, FT_GLYPH_BBOX_PIXELS, &(text_info.glyphs[text_info.length].bbox) ); | 1719 FT_Glyph_Get_CBox( text_info.glyphs[text_info.length].glyph, FT_GLYPH_BBOX_PIXELS, &(text_info.glyphs[text_info.length].bbox) ); |