23 #include <officecfg/Office/Common.hxx>
35 #include <com/sun/star/uno/Sequence.hxx>
41 using namespace ::
rtl;
42 using namespace ::
utl;
52 mnHangingBaseline( 0 ),
53 mbFullstopCentered(
false )
101 if( Font::operator!=(r) )
108 if( !Font::EqualIgnoreColor(r) )
143 , mnOrientation( static_cast<short>(rFontSelData.mnOrientation) )
150 , mbFullstopCentered(
false )
151 , mnBulletOffset( 0 )
152 , mnUnderlineSize( 0 )
153 , mnUnderlineOffset( 0 )
154 , mnBUnderlineSize( 0 )
155 , mnBUnderlineOffset( 0 )
156 , mnDUnderlineSize( 0 )
157 , mnDUnderlineOffset1( 0 )
158 , mnDUnderlineOffset2( 0 )
159 , mnWUnderlineSize( 0 )
160 , mnWUnderlineOffset( 0 )
161 , mnAboveUnderlineSize( 0 )
162 , mnAboveUnderlineOffset( 0 )
163 , mnAboveBUnderlineSize( 0 )
164 , mnAboveBUnderlineOffset( 0 )
165 , mnAboveDUnderlineSize( 0 )
166 , mnAboveDUnderlineOffset1( 0 )
167 , mnAboveDUnderlineOffset2( 0 )
168 , mnAboveWUnderlineSize( 0 )
169 , mnAboveWUnderlineOffset( 0 )
170 , mnStrikeoutSize( 0 )
171 , mnStrikeoutOffset( 0 )
172 , mnBStrikeoutSize( 0 )
173 , mnBStrikeoutOffset( 0 )
174 , mnDStrikeoutSize( 0 )
175 , mnDStrikeoutOffset1( 0 )
176 , mnDStrikeoutOffset2( 0 )
179 sal_Int32 nTokenPos = 0;
200 tools::Long nLineHeight = ((nDescent*25)+50) / 100;
207 tools::Long nBLineHeight = ((nDescent*50)+50) / 100;
208 if ( nBLineHeight == nLineHeight )
211 if ( !nBLineHeight2 )
214 tools::Long n2LineHeight = ((nDescent*16)+50) / 100;
222 if ( n2LineDY < nMin2LineDY )
223 n2LineDY = nMin2LineDY;
229 bool bCJKVertical =
MsLangId::isCJK(rFont.GetLanguage()) && rFont.IsVertical();
244 if ( nWCalcSize < 6 )
246 if ( (nWCalcSize == 1) || (nWCalcSize == 2) )
279 if ( nIntLeading <= 0 )
286 tools::Long nLineHeight = ((nIntLeading*25)+50) / 100;
290 tools::Long nBLineHeight = ((nIntLeading*50)+50) / 100;
291 if ( nBLineHeight == nLineHeight )
294 tools::Long n2LineHeight = ((nIntLeading*16)+50) / 100;
311 if ( nWCalcSize < 6 )
313 if ( (nWCalcSize == 1) || (nWCalcSize == 2) )
327 bool bCentered =
true;
332 const auto nH = rFont.GetFontSize().Height();
333 const auto nB = aRect.
Left();
336 bCentered = nB > (((nH >> 1)+nH)>>3);
346 OUString aFontIdentifier(
348 + OUString::number(rInfo.
ascender) +
"," + OUString::number(rInfo.
descender) +
","
352 css::uno::Sequence<OUString> rWinMetricFontList(
353 officecfg::Office::Common::Misc::FontsUseWinMetrics::get());
356 SAL_INFO(
"vcl.gdi.fontmetric",
"Using win metrics for: " << aFontIdentifier);
382 hb_font_t* pHbFont = pFontInstance->
GetHbFont();
383 hb_face_t* pHbFace = hb_font_get_face(pHbFont);
385 hb_blob_t* pHhea = hb_face_reference_table(pHbFace, HB_TAG(
'h',
'h',
'e',
'a'));
386 hb_blob_t* pOS2 = hb_face_reference_table(pHbFace, HB_TAG(
'O',
'S',
'/',
'2'));
389 GetTTFontMetrics(reinterpret_cast<const uint8_t*>(hb_blob_get_data(pHhea,
nullptr)), hb_blob_get_length(pHhea),
390 reinterpret_cast<const uint8_t*>(hb_blob_get_data(pOS2,
nullptr)), hb_blob_get_length(pOS2),
393 hb_blob_destroy(pHhea);
394 hb_blob_destroy(pOS2);
396 double nUPEM = hb_face_get_upem(pHbFace);
398 double fAscent = 0, fDescent = 0, fExtLeading = 0;
407 fExtLeading = rInfo.
linegap * fScale;
421 const uint16_t kUseTypoMetricsMask = 1 << 7;
447 <<
", linegap: " << rInfo.
linegap
453 hb_font_t* pHbFont = pFontInstance->
GetHbFont();
454 hb_face_t* pHbFace = hb_font_get_face(pHbFont);
455 double nUPEM = hb_face_get_upem(pHbFace);
457 hb_position_t nBaseline = 0;
459 if (hb_ot_layout_get_baseline(pHbFont,
460 HB_OT_LAYOUT_BASELINE_TAG_HANGING,
461 HB_DIRECTION_INVALID,
void SetFamily(FontFamily)
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
bool ShouldUseWinMetrics(const vcl::TTGlobalFontInfo &rInfo) const
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
std::u16string_view GetNextFontToken(std::u16string_view rTokenStr, sal_Int32 &rIndex)
size_t GetHashValueNoBase() const
void SetWeight(FontWeight)
tools::Long mnBUnderlineOffset
tools::Long mnAboveWUnderlineOffset
tools::Long mnUnderlineOffset
tools::Long mnDUnderlineOffset1
void SetCharSet(rtl_TextEncoding)
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
bool GetTextBoundRect(tools::Rectangle &rRect, const OUString &rStr, sal_Int32 nBase=0, sal_Int32 nIndex=0, sal_Int32 nLen=-1, sal_uLong nLayoutWidth=0, o3tl::span< const sal_Int32 > pDXArray={}, const SalLayoutGlyphs *pGlyphs=nullptr) const
Return the exact bounding rectangle of rStr.
int winAscent
ascender metric for Windows
FontItalic GetItalic() const
rtl_TextEncoding GetCharSet() const
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
void SetPitch(FontPitch ePitch)
FontFamily GetFamilyType() const
static bool isCJK(LanguageType nLang)
tools::Long mnWUnderlineSize
size_t GetHashValueIgnoreColor() const
size_t GetHashValue() const
void SetFamilyName(const OUString &rFamilyName)
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
int typoAscender
OS/2 portable typographic ascender.
FontWeight GetWeight() const
int ascender
typographic ascent.
ImplFontMetricData(const vcl::font::FontSelectPattern &)
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
std::enable_if_t<(sizeof(N)==4)> hash_combine(N &nSeed, T const *pValue, size_t nCount)
void SetWidthType(FontWidth)
int typoLineGap
OS/2 portable typographic line gap.
tools::Long mnDUnderlineSize
tools::Long mnBStrikeoutSize
tools::Long mnDUnderlineOffset2
bool EqualIgnoreColor(const FontMetric &) const
abstract base class for physical font faces
void SetAlignment(TextAlign)
FontMetric & operator=(const FontMetric &rMetric)
void SetStyleName(const OUString &rStyleName)
tools::Long mnAboveDUnderlineOffset2
tools::Long mnHangingBaseline
#define SAL_INFO(area, stream)
tools::Long mnBUnderlineSize
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
void SetItalic(FontItalic)
tools::Long mnBStrikeoutOffset
FontWidth GetWidthType() const
FontPitch GetPitch() const
bool EqualNoBase(const FontMetric &) const
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.
void ImplInitBaselines(LogicalFontInstance *pFontInstance)
Return value of GetTTGlobalFontInfo()
void SetFullstopCenteredFlag(bool bFullstopCentered)
bool m_bDetectedRangeSegmentation false