[Libreoffice-commits] core.git: vcl/inc vcl/unx
Khaled Hosny
khaledhosny at eglug.org
Sat Nov 26 10:59:23 UTC 2016
vcl/inc/unx/printergfx.hxx | 3
vcl/unx/generic/print/genpspgraphics.cxx | 111 +------------------------------
vcl/unx/generic/print/text_gfx.cxx | 22 ------
3 files changed, 5 insertions(+), 131 deletions(-)
New commits:
commit 368de904974b18dc5a8d237e046c0ed005f7c85d
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Thu Nov 24 09:21:56 2016 +0200
Kill PspFontLayout
It should never get used any way. CairoTextRender::GetTextLayout()
returns nullptr for the unlikely even that there is no Freetypefont for
the requested fallback level, so we do the same.
Change-Id: Ib990eb89f9f0fd2bcd87990cbd76406c8d063f57
Reviewed-on: https://gerrit.libreoffice.org/31225
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
diff --git a/vcl/inc/unx/printergfx.hxx b/vcl/inc/unx/printergfx.hxx
index 0b0512e..88c04d5 100644
--- a/vcl/inc/unx/printergfx.hxx
+++ b/vcl/inc/unx/printergfx.hxx
@@ -365,8 +365,7 @@ public:
const sal_Int32* pDeltaArray);
void SetTextColor (PrinterColor& rTextColor)
{ maTextColor = rTextColor; }
- sal_Int32 GetCharWidth (sal_uInt16 nFrom, sal_uInt16 nTo,
- long *pWidthArray);
+
// for CTL
void DrawGlyphs( const Point& rPoint,
sal_GlyphId* pGlyphIds,
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index a02005a..a0f1314 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -553,93 +553,6 @@ LogicalFontInstance* ImplPspFontData::CreateFontInstance( FontSelectPattern& rFS
return pEntry;
}
-class PspFontLayout : public GenericSalLayout
-{
-public:
- explicit PspFontLayout( ::psp::PrinterGfx& );
- virtual bool LayoutText( ImplLayoutArgs& ) override;
- virtual void InitFont() const override;
- virtual void DrawText( SalGraphics& ) const override;
-private:
- ::psp::PrinterGfx& mrPrinterGfx;
- sal_IntPtr mnFontID;
- int mnFontHeight;
- int mnFontWidth;
- bool mbVertical;
- bool mbArtItalic;
- bool mbArtBold;
-};
-
-PspFontLayout::PspFontLayout( ::psp::PrinterGfx& rGfx )
-: mrPrinterGfx( rGfx )
-{
- mnFontID = mrPrinterGfx.GetFontID();
- mnFontHeight = mrPrinterGfx.GetFontHeight();
- mnFontWidth = mrPrinterGfx.GetFontWidth();
- mbVertical = mrPrinterGfx.GetFontVertical();
- mbArtItalic = mrPrinterGfx.GetArtificialItalic();
- mbArtBold = mrPrinterGfx.GetArtificialBold();
-}
-
-bool PspFontLayout::LayoutText( ImplLayoutArgs& rArgs )
-{
- mbVertical = bool(rArgs.mnFlags & SalLayoutFlags::Vertical);
-
- long nUnitsPerPixel = 1;
- sal_GlyphId aOldGlyphId( GF_DROPPED);
- long nGlyphWidth = 0;
- int nCharPos = -1;
- Point aNewPos( 0, 0 );
- GlyphItem aPrevItem;
- rtl_TextEncoding aFontEnc = mrPrinterGfx.GetFontMgr().getFontEncoding( mnFontID );
- const int nLength = rArgs.mrStr.getLength();
- const sal_Unicode *pStr = rArgs.mrStr.getStr();
- Reserve(nLength);
-
- for(;;)
- {
- bool bRightToLeft;
- if( !rArgs.GetNextPos( &nCharPos, &bRightToLeft ) )
- break;
-
- sal_Unicode cChar = pStr[ nCharPos ];
- if( bRightToLeft )
- cChar = GetMirroredChar( cChar );
- // symbol font aliasing: 0x0020-0x00ff -> 0xf020 -> 0xf0ff
- if( aFontEnc == RTL_TEXTENCODING_SYMBOL )
- if( cChar < 256 )
- cChar += 0xf000;
- sal_GlyphId aGlyphId( cChar); // printer glyphs = unicode
-
- // update fallback_runs if needed
- psp::CharacterMetric aMetric;
- // coverity[callee_ptr_arith]
- mrPrinterGfx.GetFontMgr().getMetrics( mnFontID, cChar, cChar, &aMetric, mbVertical );
- if( aMetric.width == -1 && aMetric.height == -1 )
- rArgs.NeedFallback( nCharPos, bRightToLeft );
-
- // finish previous glyph
- if( aOldGlyphId != GF_DROPPED )
- AppendGlyph( aPrevItem );
- aOldGlyphId = aGlyphId;
- aNewPos.X() += nGlyphWidth;
-
- // prepare GlyphItem for appending it in next round
- nUnitsPerPixel = mrPrinterGfx.GetCharWidth( cChar, cChar, &nGlyphWidth );
- int nGlyphFlags = bRightToLeft ? GlyphItem::IS_RTL_GLYPH : 0;
- aGlyphId |= GF_ISCHAR;
- aPrevItem = GlyphItem( nCharPos, aGlyphId, aNewPos, nGlyphFlags, nGlyphWidth );
- }
-
- // append last glyph item if any
- if( aOldGlyphId != GF_DROPPED )
- AppendGlyph( aPrevItem );
-
- SetOrientation( mrPrinterGfx.GetFontAngle() );
- SetUnitsPerPixel( nUnitsPerPixel );
- return (aOldGlyphId != GF_DROPPED);
-}
-
class PspCommonSalLayout : public CommonSalLayout
{
public:
@@ -676,7 +589,7 @@ void PspCommonSalLayout::InitFont() const
mnOrientation, mbVertical, mbArtItalic, mbArtBold);
}
-static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx)
+void GenPspGraphics::DrawTextLayout(const CommonSalLayout& rLayout)
{
const int nMaxGlyphs = 1;
sal_GlyphId aGlyphAry[ nMaxGlyphs ];
@@ -709,26 +622,10 @@ static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx
aGlyphAry[i] = aGlyphId;
}
- rGfx.DrawGlyphs( aPos, aGlyphAry, aUnicodes, nGlyphCount, aIdxAry );
+ m_pPrinterGfx->DrawGlyphs( aPos, aGlyphAry, aUnicodes, nGlyphCount, aIdxAry );
}
}
-void PspFontLayout::InitFont() const
-{
- mrPrinterGfx.SetFont( mnFontID, mnFontHeight, mnFontWidth,
- mnOrientation, mbVertical, mbArtItalic, mbArtBold );
-}
-
-void PspFontLayout::DrawText( SalGraphics& ) const
-{
- DrawPrinterLayout(*this, mrPrinterGfx);
-}
-
-void GenPspGraphics::DrawTextLayout(const CommonSalLayout& rLayout)
-{
- DrawPrinterLayout(rLayout, *m_pPrinterGfx);
-}
-
const FontCharMapRef GenPspGraphics::GetFontCharMap() const
{
if( !m_pFreetypeFont[0] )
@@ -944,8 +841,8 @@ SalLayout* GenPspGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbac
{
if (m_pFreetypeFont[nFallbackLevel])
return new PspCommonSalLayout(*m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel]);
- else
- return new PspFontLayout(*m_pPrinterGfx);
+
+ return nullptr;
}
bool GenPspGraphics::CreateFontSubset(
diff --git a/vcl/unx/generic/print/text_gfx.cxx b/vcl/unx/generic/print/text_gfx.cxx
index bf4d4a8..12f23fd 100644
--- a/vcl/unx/generic/print/text_gfx.cxx
+++ b/vcl/unx/generic/print/text_gfx.cxx
@@ -594,28 +594,6 @@ PrinterGfx::getCharMetric (const Font2 &rFont, sal_Unicode n_char, CharacterMetr
return rFont.GetFont(0) != -1 ? rFont.GetFont(0) : rFont.GetFont(1);
}
-sal_Int32
-PrinterGfx::GetCharWidth (sal_uInt16 nFrom, sal_uInt16 nTo, long *pWidthArray)
-{
- Font2 aFont(*this);
- if (aFont.IsSymbolFont() && (nFrom < 256) && (nTo < 256))
- {
- nFrom += 0xF000;
- nTo += 0xF000;
- }
-
- for( int n = 0; n < (nTo - nFrom + 1); n++ )
- {
- CharacterMetric aBBox;
- // coverity[callee_ptr_arith]
- getCharMetric(aFont, n + nFrom, &aBBox);
- pWidthArray[n] = getCharWidth (mbTextVertical, n + nFrom, &aBBox);
- }
-
- // returned metrics have postscript precision
- return 1000;
-}
-
/*
* spool the converted truetype fonts to the page header after the page body is
* complete
More information about the Libreoffice-commits
mailing list