21 #include <officecfg/Office/Common.hxx>
32 #include <com/sun/star/uno/Sequence.hxx>
37 using namespace ::
rtl;
38 using namespace ::
utl;
48 mbFullstopCentered( false )
63 if( Font::operator!=(r) )
85 , mnOrientation( static_cast<short>(rFontSelData.mnOrientation) )
92 , mbFullstopCentered( false )
94 , mnUnderlineSize( 0 )
95 , mnUnderlineOffset( 0 )
96 , mnBUnderlineSize( 0 )
97 , mnBUnderlineOffset( 0 )
98 , mnDUnderlineSize( 0 )
99 , mnDUnderlineOffset1( 0 )
100 , mnDUnderlineOffset2( 0 )
101 , mnWUnderlineSize( 0 )
102 , mnWUnderlineOffset( 0 )
103 , mnAboveUnderlineSize( 0 )
104 , mnAboveUnderlineOffset( 0 )
105 , mnAboveBUnderlineSize( 0 )
106 , mnAboveBUnderlineOffset( 0 )
107 , mnAboveDUnderlineSize( 0 )
108 , mnAboveDUnderlineOffset1( 0 )
109 , mnAboveDUnderlineOffset2( 0 )
110 , mnAboveWUnderlineSize( 0 )
111 , mnAboveWUnderlineOffset( 0 )
112 , mnStrikeoutSize( 0 )
113 , mnStrikeoutOffset( 0 )
114 , mnBStrikeoutSize( 0 )
115 , mnBStrikeoutOffset( 0 )
116 , mnDStrikeoutSize( 0 )
117 , mnDStrikeoutOffset1( 0 )
118 , mnDStrikeoutOffset2( 0 )
121 sal_Int32 nTokenPos = 0;
142 tools::Long nLineHeight = ((nDescent*25)+50) / 100;
149 tools::Long nBLineHeight = ((nDescent*50)+50) / 100;
150 if ( nBLineHeight == nLineHeight )
153 if ( !nBLineHeight2 )
156 tools::Long n2LineHeight = ((nDescent*16)+50) / 100;
164 if ( n2LineDY < nMin2LineDY )
165 n2LineDY = nMin2LineDY;
171 bool bCJKVertical =
MsLangId::isCJK(rFont.GetLanguage()) && rFont.IsVertical();
186 if ( nWCalcSize < 6 )
188 if ( (nWCalcSize == 1) || (nWCalcSize == 2) )
221 if ( nIntLeading <= 0 )
228 tools::Long nLineHeight = ((nIntLeading*25)+50) / 100;
232 tools::Long nBLineHeight = ((nIntLeading*50)+50) / 100;
233 if ( nBLineHeight == nLineHeight )
236 tools::Long n2LineHeight = ((nIntLeading*16)+50) / 100;
253 if ( nWCalcSize < 6 )
255 if ( (nWCalcSize == 1) || (nWCalcSize == 2) )
269 bool bCentered =
true;
274 const auto nH = rFont.GetFontSize().Height();
275 const auto nB = aRect.
Left();
278 bCentered = nB > (((nH >> 1)+nH)>>3);
288 OUString aFontIdentifier(
290 + OUString::number(rInfo.
ascender) +
"," + OUString::number(rInfo.
descender) +
","
294 css::uno::Sequence<OUString> rWinMetricFontList(
295 officecfg::Office::Common::Misc::FontsUseWinMetrics::get());
298 SAL_INFO(
"vcl.gdi.fontmetric",
"Using win metrics for: " << aFontIdentifier);
324 hb_font_t* pHbFont = pFontInstance->
GetHbFont();
325 hb_face_t* pHbFace = hb_font_get_face(pHbFont);
327 hb_blob_t* pHhea = hb_face_reference_table(pHbFace, HB_TAG(
'h',
'h',
'e',
'a'));
328 hb_blob_t* pOS2 = hb_face_reference_table(pHbFace, HB_TAG(
'O',
'S',
'/',
'2'));
331 GetTTFontMetrics(reinterpret_cast<const uint8_t*>(hb_blob_get_data(pHhea,
nullptr)), hb_blob_get_length(pHhea),
332 reinterpret_cast<const uint8_t*>(hb_blob_get_data(pOS2,
nullptr)), hb_blob_get_length(pOS2),
335 hb_blob_destroy(pHhea);
336 hb_blob_destroy(pOS2);
338 double nUPEM = hb_face_get_upem(pHbFace);
340 double fAscent = 0, fDescent = 0, fExtLeading = 0;
349 fExtLeading = rInfo.
linegap * fScale;
363 const uint16_t kUseTypoMetricsMask = 1 << 7;
389 <<
", linegap: " << rInfo.
linegap
int winDescent
descender metric for Windows
tools::Long mnDStrikeoutOffset2
const OUString & GetStyleName() const
bool operator==(const FontMetric &rMetric) const
tools::Long mnDStrikeoutSize
sal_uInt16 fsSelection
OS/2 fsSelection.
tools::Long mnAboveWUnderlineSize
tools::Long mnStrikeoutOffset
tools::Long mnAboveDUnderlineSize
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
tools::Long mnBUnderlineOffset
tools::Long mnAboveWUnderlineOffset
tools::Long mnUnderlineOffset
tools::Long mnDUnderlineOffset1
void ImplInitAboveTextLineSize()
void ImplCalcLineSpacing(LogicalFontInstance *pFontInstance)
void ImplInitTextLineSize(const OutputDevice *pDev)
tools::Long mnDStrikeoutOffset1
tools::Long mnWUnderlineOffset
tools::Long mnAboveUnderlineSize
const vcl::Font & GetFont() const
tools::Long mnAboveUnderlineOffset
int winAscent
ascender metric for Windows
void GetTTFontMetrics(const uint8_t *pHhea, size_t nHhea, const uint8_t *pOs2, size_t nOs2, TTGlobalFontInfo *info)
Returns fonts metrics.
tools::Long mnAboveDUnderlineOffset1
tools::Long mnStrikeoutSize
static bool isCJK(LanguageType nLang)
tools::Long mnWUnderlineSize
int typoAscender
OS/2 portable typographic ascender.
int ascender
typographic ascent.
int descender
typographic descent.
void ImplInitFlags(const OutputDevice *pDev)
tools::Long mnUnderlineSize
void SetFamilyName(const OUString &sFamilyName)
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
tools::Long mnAboveBUnderlineOffset
int typoLineGap
OS/2 portable typographic line gap.
tools::Long mnDUnderlineSize
tools::Long mnBStrikeoutSize
tools::Long mnDUnderlineOffset2
FontMetric & operator=(const FontMetric &rMetric)
ImplFontMetricData(const FontSelectPattern &)
tools::Long mnAboveDUnderlineOffset2
#define SAL_INFO(area, stream)
tools::Long mnBUnderlineSize
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
void SetStyleName(const OUString &sStyleName)
int linegap
typographic line gap. Negative values are treated as zero in Win 3.1, System 6 and System 7...
tools::Long mnAboveBUnderlineSize
tools::Long mnBulletOffset
bool GetTextBoundRect(tools::Rectangle &rRect, const OUString &rStr, sal_Int32 nBase=0, sal_Int32 nIndex=0, sal_Int32 nLen=-1, sal_uLong nLayoutWidth=0, const tools::Long *pDXArray=nullptr, const SalLayoutGlyphs *pGlyphs=nullptr) const
Return the exact bounding rectangle of rStr.
tools::Long mnBStrikeoutOffset
OUString GetNextFontToken(const OUString &rTokenStr, sal_Int32 &rIndex)
const OUString & GetFamilyName() const
SAL_DLLPRIVATE sal_Int32 GetDPIY() const
Get the output device's DPI y-axis value.
int typoDescender
OS/2 portable typographic descender.
Return value of GetTTGlobalFontInfo()
bool ShouldUseWinMetrics(const vcl::TTGlobalFontInfo &rInfo)
void SetFullstopCenteredFlag(bool bFullstopCentered)