Fix type, calculation of FamilyFont PitchAndFamily
This patch fixes problems caused by the cleanup commit
3e7dd04dd8
for type and calculation of
FamilyFont and PitchAndFamily enumerations.
FamilyFont enumeration is described in [MS-WMF] v20210625 page 33:
"In a Font Object, when a FamilyFont value is packed into a byte
with a PitchFont Enumeration value, the result is a PitchAndFamily
Object".
Thus, we will use sal_uInt8 as the underlying type for FamilyFont.
The PitchAndFamily is created as shown in [MS-WMF] v20210625 page 96:
[0 1 2 3] 4 5 [6 7]
Family 0 0 Pitch
The values for FamilyFont enumeration are created according to the
[MS-WMF], and the calculations are changed to use '<< 4' and '>> 4'
instead of applying the same shift to the enumeration values.
Change-Id: I4f6df33ed6405589acf89ba2c9223a571cb510b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132614
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
parent
cedf0b2354
commit
51431559bd
3 changed files with 3 additions and 3 deletions
|
@ -275,7 +275,7 @@ namespace emfio
|
|||
};
|
||||
|
||||
/* [MS-WMF] - v20210625 - pages 33, */
|
||||
enum FamilyFont : sal_uInt32
|
||||
enum FamilyFont : sal_uInt8
|
||||
{
|
||||
FF_DONTCARE = 0x00,
|
||||
FF_ROMAN = 0x01,
|
||||
|
|
|
@ -336,7 +336,7 @@ void WmfTest::testTdf99402()
|
|||
logfontw.lfUnderline = 0;
|
||||
logfontw.lfStrikeOut = 0;
|
||||
logfontw.lfCharSet = emfio::CharacterSet::OEM_CHARSET;
|
||||
logfontw.lfPitchAndFamily = +emfio::FamilyFont::FF_ROMAN | +emfio::PitchFont::DEFAULT_PITCH;
|
||||
logfontw.lfPitchAndFamily = emfio::FamilyFont::FF_ROMAN << 4 | emfio::PitchFont::DEFAULT_PITCH;
|
||||
logfontw.alfFaceName = "Symbol";
|
||||
|
||||
emfio::WinMtfFontStyle fontStyle(logfontw);
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace emfio
|
|||
aFont.SetCharSet( eCharSet );
|
||||
aFont.SetFamilyName( rFont.alfFaceName );
|
||||
FontFamily eFamily;
|
||||
switch ( rFont.lfPitchAndFamily & 0xf0 )
|
||||
switch ( rFont.lfPitchAndFamily >> 4 & 0x0f )
|
||||
{
|
||||
case FamilyFont::FF_ROMAN:
|
||||
eFamily = FAMILY_ROMAN;
|
||||
|
|
Loading…
Reference in a new issue