vcl: No need to get font face from GetNextGlyphs()
We can take it from the font instance. Change-Id: I54c507d498c58e271c479b0a615b165345a1c33b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140788 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
This commit is contained in:
parent
a091ae213e
commit
e6a46b2359
@ -102,8 +102,7 @@ public:
|
||||
|
||||
// methods using glyph indexing
|
||||
virtual bool GetNextGlyph(const GlyphItem** pGlyph, DevicePoint& rPos, int& nStart,
|
||||
const LogicalFontInstance** ppGlyphFont = nullptr,
|
||||
const vcl::font::PhysicalFontFace** pFallbackFont = nullptr) const = 0;
|
||||
const LogicalFontInstance** ppGlyphFont = nullptr) const = 0;
|
||||
virtual bool GetOutline(basegfx::B2DPolyPolygonVector&) const;
|
||||
bool GetBoundRect(tools::Rectangle&) const;
|
||||
|
||||
|
@ -65,8 +65,7 @@ public:
|
||||
DeviceCoordinate FillDXArray(std::vector<DeviceCoordinate>* pDXArray, const OUString& rStr) const override;
|
||||
void GetCaretPositions(int nArraySize, sal_Int32* pCaretXArray) const override;
|
||||
bool GetNextGlyph(const GlyphItem** pGlyph, DevicePoint& rPos, int& nStart,
|
||||
const LogicalFontInstance** ppGlyphFont = nullptr,
|
||||
const vcl::font::PhysicalFontFace** pFallbackFont = nullptr) const override;
|
||||
const LogicalFontInstance** ppGlyphFont = nullptr) const override;
|
||||
bool GetOutline(basegfx::B2DPolyPolygonVector&) const override;
|
||||
bool IsKashidaPosValid(int nCharPos, int nNextCharPos) const override;
|
||||
SalLayoutGlyphs GetGlyphs() const final override;
|
||||
@ -129,8 +128,7 @@ public:
|
||||
{ return *m_GlyphItems.GetFont(); }
|
||||
|
||||
bool GetNextGlyph(const GlyphItem** pGlyph, DevicePoint& rPos, int& nStart,
|
||||
const LogicalFontInstance** ppGlyphFont = nullptr,
|
||||
const vcl::font::PhysicalFontFace** pFallbackFont = nullptr) const override;
|
||||
const LogicalFontInstance** ppGlyphFont = nullptr) const override;
|
||||
|
||||
const SalLayoutGlyphsImpl& GlyphsImpl() const { return m_GlyphItems; }
|
||||
|
||||
|
@ -6580,7 +6580,6 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
|
||||
FontMetric aRefDevFontMetric = GetFontMetric();
|
||||
const vcl::font::PhysicalFontFace* pDevFont = GetFontInstance()->GetFontFace();
|
||||
const GlyphItem* pGlyph = nullptr;
|
||||
const vcl::font::PhysicalFontFace* pFallbackFont = nullptr;
|
||||
const LogicalFontInstance* pGlyphFont = nullptr;
|
||||
|
||||
// collect the glyphs into a single array
|
||||
@ -6588,9 +6587,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
|
||||
aGlyphs.reserve( nMaxGlyphs );
|
||||
// first get all the glyphs and register them; coordinates still in Pixel
|
||||
DevicePoint aPos;
|
||||
while (rLayout.GetNextGlyph(&pGlyph, aPos, nIndex, &pGlyphFont, &pFallbackFont))
|
||||
while (rLayout.GetNextGlyph(&pGlyph, aPos, nIndex, &pGlyphFont))
|
||||
{
|
||||
const auto* pFont = pFallbackFont ? pFallbackFont : pDevFont;
|
||||
const auto* pFace = pGlyphFont->GetFontFace();
|
||||
|
||||
aCodeUnits.clear();
|
||||
|
||||
@ -6633,7 +6632,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
|
||||
// instead.
|
||||
if (!aCodeUnits.empty() && !bUseActualText)
|
||||
{
|
||||
for (const auto& rSubset : m_aSubsets[pFont].m_aSubsets)
|
||||
for (const auto& rSubset : m_aSubsets[pFace].m_aSubsets)
|
||||
{
|
||||
const auto& it = rSubset.m_aMapping.find(nGlyphId);
|
||||
if (it != rSubset.m_aMapping.cend() && it->second.codes() != aCodeUnits)
|
||||
@ -6650,7 +6649,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
|
||||
|
||||
sal_uInt8 nMappedGlyph;
|
||||
sal_Int32 nMappedFontObject;
|
||||
registerGlyph(nGlyphId, pFont, aCodeUnits, nGlyphWidth, nMappedGlyph, nMappedFontObject, pDevFont->IsColorFont());
|
||||
registerGlyph(nGlyphId, pFace, aCodeUnits, nGlyphWidth, nMappedGlyph, nMappedFontObject, pDevFont->IsColorFont());
|
||||
|
||||
int nCharPos = -1;
|
||||
if (bUseActualText || pGlyph->IsInCluster())
|
||||
@ -6658,7 +6657,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
|
||||
|
||||
aGlyphs.emplace_back(aPos,
|
||||
pGlyph,
|
||||
XUnits(pFont->UnitsPerEm(), nGlyphWidth),
|
||||
XUnits(pFace->UnitsPerEm(), nGlyphWidth),
|
||||
nMappedFontObject,
|
||||
nMappedGlyph,
|
||||
nCharPos);
|
||||
|
@ -520,8 +520,7 @@ sal_Int32 GenericSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoor
|
||||
|
||||
bool GenericSalLayout::GetNextGlyph(const GlyphItem** pGlyph,
|
||||
DevicePoint& rPos, int& nStart,
|
||||
const LogicalFontInstance** ppGlyphFont,
|
||||
const vcl::font::PhysicalFontFace**) const
|
||||
const LogicalFontInstance** ppGlyphFont) const
|
||||
{
|
||||
std::vector<GlyphItem>::const_iterator pGlyphIter = m_GlyphItems.begin();
|
||||
std::vector<GlyphItem>::const_iterator pGlyphIterEnd = m_GlyphItems.end();
|
||||
@ -1145,8 +1144,7 @@ void MultiSalLayout::GetCaretPositions( int nMaxIndex, sal_Int32* pCaretXArray )
|
||||
|
||||
bool MultiSalLayout::GetNextGlyph(const GlyphItem** pGlyph,
|
||||
DevicePoint& rPos, int& nStart,
|
||||
const LogicalFontInstance** ppGlyphFont,
|
||||
const vcl::font::PhysicalFontFace** pFallbackFont) const
|
||||
const LogicalFontInstance** ppGlyphFont) const
|
||||
{
|
||||
// NOTE: nStart is tagged with current font index
|
||||
int nLevel = static_cast<unsigned>(nStart) >> GF_FONTSHIFT;
|
||||
@ -1155,13 +1153,10 @@ bool MultiSalLayout::GetNextGlyph(const GlyphItem** pGlyph,
|
||||
{
|
||||
GenericSalLayout& rLayout = *mpLayouts[ nLevel ];
|
||||
rLayout.InitFont();
|
||||
const vcl::font::PhysicalFontFace* pFontFace = rLayout.GetFont().GetFontFace();
|
||||
if (rLayout.GetNextGlyph(pGlyph, rPos, nStart, ppGlyphFont))
|
||||
{
|
||||
int nFontTag = nLevel << GF_FONTSHIFT;
|
||||
nStart |= nFontTag;
|
||||
if (pFallbackFont)
|
||||
*pFallbackFont = pFontFace;
|
||||
rPos.adjustX(maDrawBase.getX() + maDrawOffset.X());
|
||||
rPos.adjustY(maDrawBase.getY() + maDrawOffset.Y());
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user