Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
e70aa825
Commit
e70aa825
authored
May 17, 2023
by
Piotr Caban
Committed by
Alexandre Julliard
May 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineps: Simplify PSDRV_UVMetrics implementation.
parent
1cccaa1e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
44 deletions
+32
-44
afm.c
dlls/wineps.drv/afm.c
+32
-4
builtin.c
dlls/wineps.drv/builtin.c
+0
-39
psdrv.h
dlls/wineps.drv/psdrv.h
+0
-1
No files found.
dlls/wineps.drv/afm.c
View file @
e70aa825
...
...
@@ -22,6 +22,7 @@
*/
#include <string.h>
#include <stdlib.h>
#include "psdrv.h"
#include "wine/debug.h"
...
...
@@ -185,6 +186,33 @@ static void PSDRV_DumpFontList(void)
return
;
}
/******************************************************************************
* PSDRV_UVMetrics
*
* Find the AFMMETRICS for a given UV. Returns NULL if the font does not
* have a glyph for the given UV.
*/
static
int
__cdecl
MetricsByUV
(
const
void
*
a
,
const
void
*
b
)
{
return
(
int
)(((
const
AFMMETRICS
*
)
a
)
->
UV
-
((
const
AFMMETRICS
*
)
b
)
->
UV
);
}
static
const
AFMMETRICS
*
PSDRV_UVMetrics
(
LONG
UV
,
const
AFM
*
afm
)
{
AFMMETRICS
key
;
/*
* Ugly work-around for symbol fonts. Wine is sending characters which
* belong in the Unicode private use range (U+F020 - U+F0FF) as ASCII
* characters (U+0020 - U+00FF).
*/
if
((
afm
->
Metrics
->
UV
&
0xff00
)
==
0xf000
&&
UV
<
0x100
)
UV
|=
0xf000
;
key
.
UV
=
UV
;
return
bsearch
(
&
key
,
afm
->
Metrics
,
afm
->
NumofMetrics
,
sizeof
(
AFMMETRICS
),
MetricsByUV
);
}
/*******************************************************************************
* PSDRV_CalcAvgCharWidth
...
...
@@ -208,7 +236,7 @@ static inline SHORT MeanCharWidth(const AFM *afm)
return
(
SHORT
)(
w
+
0
.
5
);
}
static
const
struct
{
LONG
UV
;
int
weight
;
}
UVweight
[
27
]
=
static
const
struct
{
LONG
UV
;
int
weight
;
}
UVweight
[]
=
{
{
0x0061
,
64
},
{
0x0062
,
14
},
{
0x0063
,
27
},
{
0x0064
,
35
},
{
0x0065
,
100
},
{
0x0066
,
20
},
{
0x0067
,
14
},
{
0x0068
,
42
},
...
...
@@ -224,13 +252,13 @@ SHORT PSDRV_CalcAvgCharWidth(const AFM *afm)
float
w
=
0
.
0
;
int
i
;
for
(
i
=
0
;
i
<
27
;
++
i
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
UVweight
)
;
++
i
)
{
const
AFMMETRICS
*
afmm
;
afmm
=
PSDRV_UVMetrics
(
UVweight
[
i
].
UV
,
afm
);
if
(
afmm
->
UV
!=
UVweight
[
i
].
UV
)
/* UVMetrics returns first glyph */
return
MeanCharWidth
(
afm
);
/* in font if UV is missing */
if
(
!
afmm
)
return
MeanCharWidth
(
afm
);
w
+=
afmm
->
WX
*
(
float
)(
UVweight
[
i
].
weight
);
}
...
...
dlls/wineps.drv/builtin.c
View file @
e70aa825
...
...
@@ -84,42 +84,3 @@ BOOL PSDRV_WriteBuiltinGlyphShow(print_ctx *ctx, LPCWSTR str, INT count)
return
TRUE
;
}
/******************************************************************************
* PSDRV_UVMetrics
*
* Find the AFMMETRICS for a given UV. Returns first glyph in the font
* (space?) if the font does not have a glyph for the given UV.
*/
static
int
__cdecl
MetricsByUV
(
const
void
*
a
,
const
void
*
b
)
{
return
(
int
)(((
const
AFMMETRICS
*
)
a
)
->
UV
-
((
const
AFMMETRICS
*
)
b
)
->
UV
);
}
const
AFMMETRICS
*
PSDRV_UVMetrics
(
LONG
UV
,
const
AFM
*
afm
)
{
AFMMETRICS
key
;
const
AFMMETRICS
*
needle
;
/*
* Ugly work-around for symbol fonts. Wine is sending characters which
* belong in the Unicode private use range (U+F020 - U+F0FF) as ASCII
* characters (U+0020 - U+00FF).
*/
if
((
afm
->
Metrics
->
UV
&
0xff00
)
==
0xf000
&&
UV
<
0x100
)
UV
|=
0xf000
;
key
.
UV
=
UV
;
needle
=
bsearch
(
&
key
,
afm
->
Metrics
,
afm
->
NumofMetrics
,
sizeof
(
AFMMETRICS
),
MetricsByUV
);
if
(
needle
==
NULL
)
{
WARN
(
"No glyph for U+%.4lX in %s
\n
"
,
UV
,
afm
->
FontName
);
needle
=
afm
->
Metrics
;
}
return
needle
;
}
dlls/wineps.drv/psdrv.h
View file @
e70aa825
...
...
@@ -501,7 +501,6 @@ INT PSDRV_GlyphListInit(void) DECLSPEC_HIDDEN;
const
GLYPHNAME
*
PSDRV_GlyphName
(
LPCSTR
szName
)
DECLSPEC_HIDDEN
;
VOID
PSDRV_IndexGlyphList
(
void
)
DECLSPEC_HIDDEN
;
BOOL
PSDRV_GetType1Metrics
(
void
)
DECLSPEC_HIDDEN
;
const
AFMMETRICS
*
PSDRV_UVMetrics
(
LONG
UV
,
const
AFM
*
afm
)
DECLSPEC_HIDDEN
;
SHORT
PSDRV_CalcAvgCharWidth
(
const
AFM
*
afm
)
DECLSPEC_HIDDEN
;
extern
BOOL
PSDRV_WriteSetBuiltinFont
(
print_ctx
*
ctx
)
DECLSPEC_HIDDEN
;
...
...
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