23#include <hb-graphite2.h>
32 , mpConversion(nullptr)
37 , mpFontCache(nullptr)
38 , m_aFontSelData(rFontSelData)
40 , m_nAveWidthFactor(1.0f)
41 , m_pFontFace(&const_cast<
vcl::font::PhysicalFontFace&>(rFontFace))
57#if HB_VERSION_ATLEAST(4, 0, 0)
59 hb_draw_funcs_destroy(m_pHbDrawFuncs);
66 hb_face_t* pHbFace = pFace->GetHbFace();
68 auto nUPEM = pFace->UnitsPerEm();
70 hb_font_t* pHbFont = hb_font_create(pHbFace);
71 hb_font_set_scale(pHbFont, nUPEM, nUPEM);
72 hb_ot_font_set_funcs(pHbFont);
74 auto aVariations = pFace->GetVariations(*
this);
75 if (!aVariations.empty())
76 hb_font_set_variations(pHbFont, aVariations.data(), aVariations.size());
78#if HB_VERSION_ATLEAST(3, 3, 0)
94#if HB_VERSION_ATLEAST(3, 3, 0)
130 *nYScale = nHeight / nUPEM;
133 *nXScale = nWidth / nUPEM;
137 const OUString& rFontName,
bool bEmbolden,
147 OUString* pFontName,
bool* pEmbolden,
150 UnicodeFallbackList::const_iterator it
155 const MapEntry& rEntry = (*it).second;
163 std::u16string_view rFontName)
165 UnicodeFallbackList::iterator it
169 const MapEntry& rEntry = (*it).second;
175 bool bVertical)
const
190 if (hb_font_get_glyph(pHbFont, nUnicode, nVariationSelector, &nGlyph))
200 nWidth = hb_font_get_glyph_v_advance(pHbFont, nGlyph);
202 nWidth = hb_font_get_glyph_h_advance(pHbFont, nGlyph);
209 return double(nWidth * nScale);
217 = hb_graphite2_face_get_gr_face(hb_font_get_face(
GetHbFont())) !=
nullptr;
242 if (nYOffset == -839)
262#if HB_VERSION_ATLEAST(4, 0, 0)
265void move_to_func(hb_draw_funcs_t*,
void* , hb_draw_state_t*,
float to_x,
float to_y,
272void line_to_func(hb_draw_funcs_t*,
void* , hb_draw_state_t*,
float to_x,
float to_y,
279void cubic_to_func(hb_draw_funcs_t*,
void* , hb_draw_state_t*,
float control1_x,
280 float control1_y,
float control2_x,
float control2_y,
float to_x,
float to_y,
289void close_path_func(hb_draw_funcs_t*,
void* pDrawData, hb_draw_state_t*,
void* pUserData)
293 pPolyPoly->
append(*pPoly);
302#if HB_VERSION_ATLEAST(4, 0, 0)
305 m_pHbDrawFuncs = hb_draw_funcs_create();
307 hb_draw_funcs_set_move_to_func(m_pHbDrawFuncs, move_to_func, pUserData,
nullptr);
308 hb_draw_funcs_set_line_to_func(m_pHbDrawFuncs, line_to_func, pUserData,
nullptr);
309 hb_draw_funcs_set_cubic_to_func(m_pHbDrawFuncs, cubic_to_func, pUserData,
nullptr);
314 hb_draw_funcs_set_close_path_func(m_pHbDrawFuncs, close_path_func, pUserData,
nullptr);
constexpr float ARTIFICIAL_ITALIC_SKEW
FontItalic GetItalic() const
FontWeight GetWeight() const
bool GetCachedGlyphBoundRect(const LogicalFontInstance *, sal_GlyphId, tools::Rectangle &)
void CacheGlyphBoundRect(const LogicalFontInstance *, sal_GlyphId, tools::Rectangle &)
std::optional< bool > m_xbIsGraphiteFont
bool NeedsArtificialBold() const
void GetScale(double *nXScale, double *nYScale) const
const vcl::font::PhysicalFontFace * GetFontFace() const
LogicalFontInstance(const vcl::font::PhysicalFontFace &, const vcl::font::FontSelectPattern &)
void AddFallbackForUnicode(sal_UCS4 cChar, FontWeight eWeight, const OUString &rFontName, bool bEmbolden, const ItalicMatrix &rMatrix)
double GetGlyphWidth(sal_GlyphId, bool=false, bool=true) const
bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle &, bool) const
ImplFontMetricDataRef mxFontMetric
const vcl::font::FontSelectPattern m_aFontSelData
virtual void ImplInitHbFont(hb_font_t *)
bool GetFallbackForUnicode(sal_UCS4 cInChar, FontWeight eInWeight, OUString *pOutFontName, bool *pOutEmbolden, ItalicMatrix *pOutItalicMatrix) const
ImplFontCache * mpFontCache
bool NeedsArtificialItalic() const
virtual bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle &, bool) const =0
rtl::Reference< vcl::font::PhysicalFontFace > m_pFontFace
std::optional< FontFamilyEnum > m_xeFontFamilyEnum
hb_font_t * m_pHbFontUntransformed
bool NeedOffsetCorrection(sal_Int32 nYOffset)
void IgnoreFallbackForUnicode(sal_UCS4, FontWeight eWeight, std::u16string_view rFontName)
bool GetGlyphOutlineUntransformed(sal_GlyphId, basegfx::B2DPolyPolygon &) const
int GetKashidaWidth() const
UnicodeFallbackList maUnicodeFallbackList
virtual ~LogicalFontInstance() override
hb_font_t * GetHbFontUntransformed() const
sal_GlyphId GetGlyphIndex(uint32_t, uint32_t=0) const
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void appendBezierSegment(const basegfx::B2DPoint &rNextControlPoint, const basegfx::B2DPoint &rPrevControlPoint, const basegfx::B2DPoint &rPoint)
abstract base class for physical font faces
uint32_t UnitsPerEm() const
virtual OUString GetName() const override
ItalicMatrix aItalicMatrix