1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

gdiplus: Implement font linking in GdipAddPathString.

This commit is contained in:
Esme Povirk 2024-03-01 19:27:30 +00:00 committed by Alexandre Julliard
parent 3ca8204837
commit 55f71fd846
3 changed files with 30 additions and 1 deletions

View file

@ -127,6 +127,10 @@ extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1,
extern void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj,
REAL tension, REAL *x, REAL *y);
extern void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font,
GDIPCONST GpStringFormat *format, HFONT *hfont,
LOGFONTW *lfw_return, GDIPCONST GpMatrix *matrix);
extern void free_installed_fonts(void);
extern BOOL lengthen_path(GpPath *path, INT len);

View file

@ -2296,7 +2296,7 @@ void get_log_fontW(const GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
lstrcpyW(lf->lfFaceName, font->family->FamilyName);
}
static void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font,
void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font,
GDIPCONST GpStringFormat *format, HFONT *hfont,
LOGFONTW *lfw_return, GDIPCONST GpMatrix *matrix)
{

View file

@ -1001,6 +1001,9 @@ static GpStatus format_string_callback(struct gdip_format_string_info* info)
{
static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} };
struct format_string_args *args = info->user_data;
struct gdip_font_link_section *section = LIST_ENTRY(list_head(&info->font_link_info.sections), struct gdip_font_link_section, entry);
HFONT hfont = NULL, oldhfont = NULL;
int section_start = -1;
GpPath *path = args->path;
GpStatus status = Ok;
float x = info->rect->X + (info->bounds->X - info->rect->X) * args->scale;
@ -1019,6 +1022,22 @@ static GpStatus format_string_callback(struct gdip_format_string_info* info)
TTPOLYGONHEADER *ph = NULL, *origph;
char *start;
DWORD len, ofs = 0;
while (i >= section->end)
section = LIST_ENTRY(list_next(&info->font_link_info.sections, &section->entry), struct gdip_font_link_section, entry);
if (section_start != section->start)
{
if (hfont)
{
SelectObject(info->hdc, oldhfont);
DeleteObject(hfont);
}
get_font_hfont(info->graphics, section->font, NULL, &hfont, NULL, NULL);
oldhfont = SelectObject(info->hdc, hfont);
section_start = section->start;
}
len = GetGlyphOutlineW(info->hdc, info->string[i], GGO_BEZIER, &gm, 0, NULL, &identity);
if (len == GDI_ERROR)
{
@ -1085,6 +1104,12 @@ static GpStatus format_string_callback(struct gdip_format_string_info* info)
break;
}
if (hfont)
{
SelectObject(info->hdc, oldhfont);
DeleteObject(hfont);
}
return status;
}