gdiplus: Retrieve LOGFONT from a GpFont using GdipGetLogFontW instead of accessing it directly.
This commit is contained in:
parent
5ae4238cea
commit
2c93bf7e4e
|
@ -2136,15 +2136,13 @@ void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font, HFONT *hfont)
|
||||||
rel_height = sqrt((pt[2].Y-pt[0].Y)*(pt[2].Y-pt[0].Y)+
|
rel_height = sqrt((pt[2].Y-pt[0].Y)*(pt[2].Y-pt[0].Y)+
|
||||||
(pt[2].X-pt[0].X)*(pt[2].X-pt[0].X));
|
(pt[2].X-pt[0].X)*(pt[2].X-pt[0].X));
|
||||||
|
|
||||||
lfw = font->lfw;
|
GdipGetLogFontW((GpFont *)font, graphics, &lfw);
|
||||||
lfw.lfHeight = roundr(-font->pixel_size * rel_height);
|
lfw.lfHeight = roundr(lfw.lfHeight * rel_height);
|
||||||
unscaled_font = CreateFontIndirectW(&lfw);
|
unscaled_font = CreateFontIndirectW(&lfw);
|
||||||
|
|
||||||
SelectObject(hdc, unscaled_font);
|
SelectObject(hdc, unscaled_font);
|
||||||
GetTextMetricsW(hdc, &textmet);
|
GetTextMetricsW(hdc, &textmet);
|
||||||
|
|
||||||
lfw = font->lfw;
|
|
||||||
lfw.lfHeight = roundr(-font->pixel_size * rel_height);
|
|
||||||
lfw.lfWidth = roundr(textmet.tmAveCharWidth * rel_width / rel_height);
|
lfw.lfWidth = roundr(textmet.tmAveCharWidth * rel_width / rel_height);
|
||||||
lfw.lfEscapement = lfw.lfOrientation = roundr((angle / M_PI) * 1800.0);
|
lfw.lfEscapement = lfw.lfOrientation = roundr((angle / M_PI) * 1800.0);
|
||||||
|
|
||||||
|
@ -4919,6 +4917,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
|
||||||
{
|
{
|
||||||
GpStatus stat;
|
GpStatus stat;
|
||||||
int i;
|
int i;
|
||||||
|
LOGFONTW lfw;
|
||||||
HFONT oldfont;
|
HFONT oldfont;
|
||||||
struct measure_ranges_args args;
|
struct measure_ranges_args args;
|
||||||
HDC hdc, temp_hdc=NULL;
|
HDC hdc, temp_hdc=NULL;
|
||||||
|
@ -4932,6 +4931,9 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
|
||||||
if (regionCount < stringFormat->range_count)
|
if (regionCount < stringFormat->range_count)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
|
stat = GdipGetLogFontW((GpFont *)font, graphics, &lfw);
|
||||||
|
if (stat != Ok) return stat;
|
||||||
|
|
||||||
if(!graphics->hdc)
|
if(!graphics->hdc)
|
||||||
{
|
{
|
||||||
hdc = temp_hdc = CreateCompatibleDC(0);
|
hdc = temp_hdc = CreateCompatibleDC(0);
|
||||||
|
@ -4943,7 +4945,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
|
||||||
if (stringFormat->attr)
|
if (stringFormat->attr)
|
||||||
TRACE("may be ignoring some format flags: attr %x\n", stringFormat->attr);
|
TRACE("may be ignoring some format flags: attr %x\n", stringFormat->attr);
|
||||||
|
|
||||||
oldfont = SelectObject(hdc, CreateFontIndirectW(&font->lfw));
|
oldfont = SelectObject(hdc, CreateFontIndirectW(&lfw));
|
||||||
|
|
||||||
for (i=0; i<stringFormat->range_count; i++)
|
for (i=0; i<stringFormat->range_count; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -942,6 +942,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
|
||||||
{
|
{
|
||||||
GpFont *font;
|
GpFont *font;
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
|
LOGFONTW lfw;
|
||||||
HANDLE hfont;
|
HANDLE hfont;
|
||||||
HDC dc;
|
HDC dc;
|
||||||
GpPath *backup;
|
GpPath *backup;
|
||||||
|
@ -956,7 +957,9 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
|
||||||
if (status != Ok)
|
if (status != Ok)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
hfont = CreateFontIndirectW(&font->lfw);
|
status = GdipGetLogFontW((GpFont *)font, NULL, &lfw);
|
||||||
|
if (status != Ok) return status;
|
||||||
|
hfont = CreateFontIndirectW(&lfw);
|
||||||
if (!hfont)
|
if (!hfont)
|
||||||
{
|
{
|
||||||
WARN("Failed to create font\n");
|
WARN("Failed to create font\n");
|
||||||
|
|
Loading…
Reference in New Issue