mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 22:41:30 +03:00
Recognize scale when plotting fonts
This commit is contained in:
parent
66af93863d
commit
a2688fc7a2
43
atari/font.c
43
atari/font.c
@ -57,22 +57,53 @@ extern FONT_PLOTTER fplotter;
|
||||
|
||||
static bool atari_font_position_in_string(const plot_font_style_t * fstyle,const char *string,
|
||||
size_t length,int x, size_t *char_offset, int *actual_x )
|
||||
{
|
||||
fplotter->pixel_pos(fplotter, fstyle, string, length, x, char_offset, actual_x );
|
||||
{
|
||||
float scale = plot_get_scale();
|
||||
|
||||
if (scale != 1.0) {
|
||||
plot_font_style_t newstyle = *fstyle;
|
||||
newstyle.size = (int)((float)fstyle->size*scale);
|
||||
fplotter->pixel_pos(fplotter, &newstyle, string, length, x, char_offset, actual_x);
|
||||
} else {
|
||||
fplotter->pixel_pos(fplotter, fstyle, string, length, x, char_offset, actual_x);
|
||||
}
|
||||
|
||||
return( true );
|
||||
}
|
||||
|
||||
static bool atari_font_split( const plot_font_style_t * fstyle, const char *string,
|
||||
size_t length,int x, size_t *char_offset, int *actual_x )
|
||||
{
|
||||
fplotter->str_split( fplotter, fstyle, string, length, x, char_offset, actual_x );
|
||||
{
|
||||
float scale = plot_get_scale();
|
||||
|
||||
if (scale != 1.0) {
|
||||
plot_font_style_t newstyle = *fstyle;
|
||||
newstyle.size = (int)((float)fstyle->size*scale);
|
||||
fplotter->str_split(fplotter, &newstyle, string, length, x, char_offset,
|
||||
actual_x);
|
||||
} else {
|
||||
fplotter->str_split(fplotter, fstyle, string, length, x, char_offset,
|
||||
actual_x);
|
||||
}
|
||||
|
||||
|
||||
return( true );
|
||||
}
|
||||
|
||||
static bool atari_font_width( const plot_font_style_t *fstyle, const char * str,
|
||||
size_t length, int * width )
|
||||
{
|
||||
fplotter->str_width( fplotter, fstyle, str, length, width );
|
||||
{
|
||||
float scale = plot_get_scale();
|
||||
|
||||
if (scale != 1.0) {
|
||||
plot_font_style_t newstyle = *fstyle;
|
||||
newstyle.size = (int)((float)fstyle->size*scale);
|
||||
fplotter->str_width(fplotter, &newstyle, str, length, width);
|
||||
} else {
|
||||
fplotter->str_width(fplotter, fstyle, str, length, width);
|
||||
}
|
||||
|
||||
|
||||
return( true );
|
||||
}
|
||||
|
||||
|
@ -2004,7 +2004,14 @@ void plot_set_text_plotter(FONT_PLOTTER font_plotter)
|
||||
|
||||
static bool plot_text(int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle )
|
||||
{
|
||||
fplotter->text(fplotter, x, y, text, length, fstyle);
|
||||
if (view.scale != 1.0) {
|
||||
plot_font_style_t newstyle = *fstyle;
|
||||
newstyle.size = (int)((float)fstyle->size*view.scale);
|
||||
fplotter->text(fplotter, x, y, text, length, &newstyle);
|
||||
} else {
|
||||
fplotter->text(fplotter, x, y, text, length, fstyle);
|
||||
}
|
||||
|
||||
return ( true );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user