Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
786b931e
Commit
786b931e
authored
Mar 14, 2013
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Apr 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Introduce macros to calculate outline text metrics.
parent
afa527c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
30 deletions
+34
-30
freetype.c
dlls/gdi32/freetype.c
+34
-30
No files found.
dlls/gdi32/freetype.c
View file @
786b931e
...
...
@@ -6878,15 +6878,17 @@ static BOOL get_outline_text_metrics(GdiFont *font)
font
->
ntmCellHeight
=
ascent
+
descent
;
font
->
ntmAvgWidth
=
pOS2
->
xAvgCharWidth
;
#define SCALE_X(x) ((pFT_MulFix(x, x_scale) + 32) >> 6)
#define SCALE_Y(y) ((pFT_MulFix(y, y_scale) + 32) >> 6)
if
(
font
->
yMax
)
{
TM
.
tmAscent
=
font
->
yMax
;
TM
.
tmDescent
=
-
font
->
yMin
;
TM
.
tmInternalLeading
=
(
TM
.
tmAscent
+
TM
.
tmDescent
)
-
ft_face
->
size
->
metrics
.
y_ppem
;
}
else
{
TM
.
tmAscent
=
(
pFT_MulFix
(
ascent
,
y_scale
)
+
32
)
>>
6
;
TM
.
tmDescent
=
(
pFT_MulFix
(
descent
,
y_scale
)
+
32
)
>>
6
;
TM
.
tmInternalLeading
=
(
pFT_MulFix
(
ascent
+
descent
-
ft_face
->
units_per_EM
,
y_scale
)
+
32
)
>>
6
;
TM
.
tmAscent
=
SCALE_Y
(
ascent
);
TM
.
tmDescent
=
SCALE_Y
(
descent
);
TM
.
tmInternalLeading
=
SCALE_Y
(
ascent
+
descent
-
ft_face
->
units_per_EM
);
}
TM
.
tmHeight
=
TM
.
tmAscent
+
TM
.
tmDescent
;
...
...
@@ -6894,15 +6896,15 @@ static BOOL get_outline_text_metrics(GdiFont *font)
/* MSDN says:
el = MAX(0, LineGap - ((WinAscent + WinDescent) - (Ascender - Descender)))
*/
TM
.
tmExternalLeading
=
max
(
0
,
(
pFT_MulFix
(
pHori
->
Line_Gap
-
((
ascent
+
descent
)
-
(
pHori
->
Ascender
-
pHori
->
Descender
)),
y_scale
)
+
32
)
>>
6
);
TM
.
tmExternalLeading
=
max
(
0
,
SCALE_Y
(
pHori
->
Line_Gap
-
((
ascent
+
descent
)
-
(
pHori
->
Ascender
-
pHori
->
Descender
)))
);
TM
.
tmAveCharWidth
=
(
pFT_MulFix
(
pOS2
->
xAvgCharWidth
,
x_scale
)
+
32
)
>>
6
;
TM
.
tmAveCharWidth
=
SCALE_X
(
pOS2
->
xAvgCharWidth
)
;
if
(
TM
.
tmAveCharWidth
==
0
)
{
TM
.
tmAveCharWidth
=
1
;
}
TM
.
tmMaxCharWidth
=
(
pFT_MulFix
(
ft_face
->
bbox
.
xMax
-
ft_face
->
bbox
.
xMin
,
x_scale
)
+
32
)
>>
6
;
TM
.
tmMaxCharWidth
=
SCALE_X
(
ft_face
->
bbox
.
xMax
-
ft_face
->
bbox
.
xMin
)
;
TM
.
tmWeight
=
FW_REGULAR
;
if
(
font
->
fake_bold
)
TM
.
tmWeight
=
FW_BOLD
;
...
...
@@ -7036,36 +7038,38 @@ static BOOL get_outline_text_metrics(GdiFont *font)
font
->
potm
->
otmsCharSlopeRun
=
pHori
->
caret_Slope_Run
;
font
->
potm
->
otmItalicAngle
=
0
;
/* POST table */
font
->
potm
->
otmEMSquare
=
ft_face
->
units_per_EM
;
font
->
potm
->
otmAscent
=
(
pFT_MulFix
(
pOS2
->
sTypoAscender
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmDescent
=
(
pFT_MulFix
(
pOS2
->
sTypoDescender
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmLineGap
=
(
pFT_MulFix
(
pOS2
->
sTypoLineGap
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmsCapEmHeight
=
(
pFT_MulFix
(
pOS2
->
sCapHeight
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmsXHeight
=
(
pFT_MulFix
(
pOS2
->
sxHeight
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmrcFontBox
.
left
=
(
pFT_MulFix
(
ft_face
->
bbox
.
xMin
,
x_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmrcFontBox
.
right
=
(
pFT_MulFix
(
ft_face
->
bbox
.
xMax
,
x_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmrcFontBox
.
top
=
(
pFT_MulFix
(
ft_face
->
bbox
.
yMax
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmrcFontBox
.
bottom
=
(
pFT_MulFix
(
ft_face
->
bbox
.
yMin
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmAscent
=
SCALE_Y
(
pOS2
->
sTypoAscender
)
;
font
->
potm
->
otmDescent
=
SCALE_Y
(
pOS2
->
sTypoDescender
)
;
font
->
potm
->
otmLineGap
=
SCALE_Y
(
pOS2
->
sTypoLineGap
)
;
font
->
potm
->
otmsCapEmHeight
=
SCALE_Y
(
pOS2
->
sCapHeight
)
;
font
->
potm
->
otmsXHeight
=
SCALE_Y
(
pOS2
->
sxHeight
)
;
font
->
potm
->
otmrcFontBox
.
left
=
SCALE_X
(
ft_face
->
bbox
.
xMin
)
;
font
->
potm
->
otmrcFontBox
.
right
=
SCALE_X
(
ft_face
->
bbox
.
xMax
)
;
font
->
potm
->
otmrcFontBox
.
top
=
SCALE_Y
(
ft_face
->
bbox
.
yMax
)
;
font
->
potm
->
otmrcFontBox
.
bottom
=
SCALE_Y
(
ft_face
->
bbox
.
yMin
)
;
font
->
potm
->
otmMacAscent
=
TM
.
tmAscent
;
font
->
potm
->
otmMacDescent
=
-
TM
.
tmDescent
;
font
->
potm
->
otmMacLineGap
=
font
->
potm
->
otmLineGap
;
font
->
potm
->
otmusMinimumPPEM
=
0
;
/* TT Header */
font
->
potm
->
otmptSubscriptSize
.
x
=
(
pFT_MulFix
(
pOS2
->
ySubscriptXSize
,
x_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmptSubscriptSize
.
y
=
(
pFT_MulFix
(
pOS2
->
ySubscriptYSize
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmptSubscriptOffset
.
x
=
(
pFT_MulFix
(
pOS2
->
ySubscriptXOffset
,
x_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmptSubscriptOffset
.
y
=
(
pFT_MulFix
(
pOS2
->
ySubscriptYOffset
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmptSuperscriptSize
.
x
=
(
pFT_MulFix
(
pOS2
->
ySuperscriptXSize
,
x_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmptSuperscriptSize
.
y
=
(
pFT_MulFix
(
pOS2
->
ySuperscriptYSize
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmptSuperscriptOffset
.
x
=
(
pFT_MulFix
(
pOS2
->
ySuperscriptXOffset
,
x_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmptSuperscriptOffset
.
y
=
(
pFT_MulFix
(
pOS2
->
ySuperscriptYOffset
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmsStrikeoutSize
=
(
pFT_MulFix
(
pOS2
->
yStrikeoutSize
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmsStrikeoutPosition
=
(
pFT_MulFix
(
pOS2
->
yStrikeoutPosition
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmptSubscriptSize
.
x
=
SCALE_X
(
pOS2
->
ySubscriptXSize
)
;
font
->
potm
->
otmptSubscriptSize
.
y
=
SCALE_Y
(
pOS2
->
ySubscriptYSize
)
;
font
->
potm
->
otmptSubscriptOffset
.
x
=
SCALE_X
(
pOS2
->
ySubscriptXOffset
)
;
font
->
potm
->
otmptSubscriptOffset
.
y
=
SCALE_Y
(
pOS2
->
ySubscriptYOffset
)
;
font
->
potm
->
otmptSuperscriptSize
.
x
=
SCALE_X
(
pOS2
->
ySuperscriptXSize
)
;
font
->
potm
->
otmptSuperscriptSize
.
y
=
SCALE_Y
(
pOS2
->
ySuperscriptYSize
)
;
font
->
potm
->
otmptSuperscriptOffset
.
x
=
SCALE_X
(
pOS2
->
ySuperscriptXOffset
)
;
font
->
potm
->
otmptSuperscriptOffset
.
y
=
SCALE_Y
(
pOS2
->
ySuperscriptYOffset
)
;
font
->
potm
->
otmsStrikeoutSize
=
SCALE_Y
(
pOS2
->
yStrikeoutSize
)
;
font
->
potm
->
otmsStrikeoutPosition
=
SCALE_Y
(
pOS2
->
yStrikeoutPosition
)
;
if
(
!
pPost
)
{
font
->
potm
->
otmsUnderscoreSize
=
0
;
font
->
potm
->
otmsUnderscorePosition
=
0
;
}
else
{
font
->
potm
->
otmsUnderscoreSize
=
(
pFT_MulFix
(
pPost
->
underlineThickness
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmsUnderscorePosition
=
(
pFT_MulFix
(
pPost
->
underlinePosition
,
y_scale
)
+
32
)
>>
6
;
font
->
potm
->
otmsUnderscoreSize
=
SCALE_Y
(
pPost
->
underlineThickness
)
;
font
->
potm
->
otmsUnderscorePosition
=
SCALE_Y
(
pPost
->
underlinePosition
)
;
}
#undef SCALE_X
#undef SCALE_Y
#undef TM
/* otmp* members should clearly have type ptrdiff_t, but M$ knows best */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment