Kaydet (Commit) 47ea13ef authored tarafından Khaled Hosny's avatar Khaled Hosny

Kill the old Unix layout engines

Change-Id: I9e1667faf9644dfab025c82cb11a6490d1e8f998
Reviewed-on: https://gerrit.libreoffice.org/31221Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarKhaled Hosny <khaledhosny@eglug.org>
üst 8b920435
......@@ -543,7 +543,6 @@ vcl_headless_freetype_code=\
vcl/headless/svpglyphcache \
vcl/unx/generic/gdi/cairotextrender \
vcl/unx/generic/glyphs/freetype_glyphcache \
vcl/unx/generic/glyphs/gcach_layout \
vcl/unx/generic/glyphs/glyphcache \
vcl/unx/generic/fontmanager/fontsubst \
vcl/unx/generic/fontmanager/fontcache \
......
......@@ -34,7 +34,6 @@ class PhysicalFontCollection;
namespace psp { struct JobData; class PrinterGfx; }
class FreetypeFont;
class ServerFontLayout;
class FontAttributes;
class SalInfoPrinter;
class GlyphCache;
......
......@@ -43,8 +43,6 @@ class GlyphData;
class FontConfigFontOptions;
class PhysicalFontCollection;
class FreetypeFont;
class ServerFontLayout;
class ServerFontLayoutEngine;
class SvpGcpHelper;
namespace basegfx { class B2DPolyPolygon; }
......@@ -178,7 +176,6 @@ public:
private:
friend class GlyphCache;
friend class ServerFontLayout;
friend class FreetypeFontInstance;
friend class X11SalGraphics;
friend class CairoTextRender;
......@@ -193,9 +190,6 @@ private:
void ReleaseFromGarbageCollect();
void ApplyGlyphTransform( int nGlyphFlags, FT_GlyphRec_* ) const;
void ApplyGSUB( const FontSelectPattern& );
ServerFontLayoutEngine* GetLayoutEngine();
typedef std::unordered_map<int,GlyphData> GlyphList;
mutable GlyphList maGlyphList;
......@@ -233,7 +227,6 @@ private:
typedef std::unordered_map<int,int> GlyphSubstitution;
GlyphSubstitution maGlyphSubstitution;
ServerFontLayoutEngine* mpLayoutEngine;
hb_font_t* mpHbFont;
};
......@@ -250,42 +243,6 @@ private:
FreetypeFont* mpFreetypeFont;
};
class VCL_DLLPUBLIC ServerFontLayout : public GenericSalLayout
{
public:
ServerFontLayout( FreetypeFont& );
virtual bool LayoutText( ImplLayoutArgs& ) override;
virtual void AdjustLayout( ImplLayoutArgs& ) override;
virtual void DrawText( SalGraphics& ) const override;
void SetNeedFallback(
ImplLayoutArgs& rArgs,
sal_Int32 nIndex,
bool bRightToLeft);
FreetypeFont& GetFreetypeFont() const { return mrFreetypeFont; }
virtual std::shared_ptr<vcl::TextLayoutCache>
CreateTextLayoutCache(OUString const&) const override;
private:
FreetypeFont& mrFreetypeFont;
css::uno::Reference<css::i18n::XBreakIterator> mxBreak;
ServerFontLayout( const ServerFontLayout& ) = delete;
ServerFontLayout& operator=( const ServerFontLayout& ) = delete;
};
class ServerFontLayoutEngine
{
public:
virtual ~ServerFontLayoutEngine() {}
virtual bool Layout(ServerFontLayout&, ImplLayoutArgs&) = 0;
};
#endif // INCLUDED_VCL_INC_GENERIC_GLYPHCACHE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -54,7 +54,6 @@ class X11OpenGLSalGraphicsImpl;
class X11OpenGLSalVirtualDevice;
class FreetypeFont;
class ImplLayoutArgs;
class ServerFontLayout;
class PhysicalFontCollection;
class PhysicalFontFace;
class SalGraphicsImpl;
......@@ -66,7 +65,6 @@ namespace basegfx {
class VCLPLUG_GEN_PUBLIC X11SalGraphics : public SalGraphics
{
friend class ServerFontLayout;
friend class X11SalGraphicsImpl;
friend class X11OpenGLSalGraphicsImpl;
friend class X11CairoTextRender;
......
......@@ -120,17 +120,13 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
FcResult eOutRes = FcPatternGetBool( pPattern, FC_OUTLINE, 0, &bOutline );
if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) )
continue;
if (SalLayout::UseCommonLayout())
{
// Ignore Type 1 fonts; CommonSalLayout does not support them.
FcChar8* pFormat = nullptr;
FcResult eFormatRes = FcPatternGetString(pPattern, FC_FONTFORMAT, 0, &pFormat);
if ((eFormatRes == FcResultMatch) &&
(strcmp(reinterpret_cast<char*>(pFormat), "Type 1") == 0))
{
continue;
}
}
// Ignore Type 1 fonts, too.
FcChar8* pFormat = nullptr;
FcResult eFormatRes = FcPatternGetString(pPattern, FC_FONTFORMAT, 0, &pFormat);
if ((eFormatRes == FcResultMatch) && (strcmp(reinterpret_cast<char*>(pFormat), "Type 1") == 0))
continue;
FcPatternReference( pPattern );
FcFontSetAdd( m_pOutlineSet, pPattern );
}
......
......@@ -185,9 +185,6 @@ void CairoTextRender::DrawServerFontLayout( const GenericSalLayout& rLayout, con
case GF_ROTL: // left
glyph_extrarotation.push_back(1);
break;
case GF_ROTR: // right
glyph_extrarotation.push_back(-1);
break;
default:
glyph_extrarotation.push_back(0);
break;
......@@ -293,35 +290,17 @@ void CairoTextRender::DrawServerFontLayout( const GenericSalLayout& rLayout, con
//like them
double xdiff = 0.0;
double ydiff = 0.0;
if (nGlyphRotation == 1)
if (nGlyphRotation)
{
if (SalLayout::UseCommonLayout())
{
// The y is the origin point position, but Cairo will draw
// the glyph *above* that point, we need to move it down to
// the glyph’s baseline.
cairo_text_extents_t aExt;
cairo_glyph_extents(cr, &cairo_glyphs[nStartIndex], nLen, &aExt);
double nDescender = std::fmax(aExt.height + aExt.y_bearing, 0);
ydiff = (aExt.x_advance - nDescender) / nHeight;
}
else
{
ydiff = font_extents.ascent/nHeight;
}
// The y is the origin point position, but Cairo will draw
// the glyph *above* that point, we need to move it down to
// the glyph’s baseline.
cairo_text_extents_t aExt;
cairo_glyph_extents(cr, &cairo_glyphs[nStartIndex], nLen, &aExt);
double nDescender = std::fmax(aExt.height + aExt.y_bearing, 0);
ydiff = (aExt.x_advance - nDescender) / nHeight;
xdiff = -font_extents.descent/nHeight;
}
else if (nGlyphRotation == -1)
{
cairo_text_extents_t text_extents;
cairo_glyph_extents(cr, &cairo_glyphs[nStartIndex], nLen,
&text_extents);
xdiff = -text_extents.x_advance/nHeight;
//to restore an apparent bug in the original X11 impl, replace
//nHeight with nWidth below
xdiff += font_extents.descent/nHeight;
}
cairo_matrix_translate(&m, xdiff, ydiff);
}
......@@ -506,10 +485,7 @@ SalLayout* CairoTextRender::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackL
if( mpFreetypeFont[ nFallbackLevel ]
&& !(rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing) )
{
if (SalLayout::UseCommonLayout())
pLayout = new CommonSalLayout(*mpFreetypeFont[nFallbackLevel]);
else
pLayout = new ServerFontLayout( *mpFreetypeFont[ nFallbackLevel ] );
pLayout = new CommonSalLayout(*mpFreetypeFont[nFallbackLevel]);
}
return pLayout;
......
This diff is collapsed.
......@@ -640,48 +640,6 @@ bool PspFontLayout::LayoutText( ImplLayoutArgs& rArgs )
return (aOldGlyphId != GF_DROPPED);
}
class PspServerFontLayout : public ServerFontLayout
{
public:
PspServerFontLayout( psp::PrinterGfx&, FreetypeFont& rFont, const ImplLayoutArgs& rArgs );
virtual void InitFont() const override;
const sal_Unicode* getTextPtr() const { return maText.getStr() - mnMinCharPos; }
int getMinCharPos() const { return mnMinCharPos; }
int getMaxCharPos() const { return mnMinCharPos+maText.getLength()-1; }
private:
::psp::PrinterGfx& mrPrinterGfx;
sal_IntPtr mnFontID;
int mnFontHeight;
int mnFontWidth;
bool mbVertical;
bool mbArtItalic;
bool mbArtBold;
OUString maText;
int mnMinCharPos;
};
PspServerFontLayout::PspServerFontLayout( ::psp::PrinterGfx& rGfx, FreetypeFont& rFont, const ImplLayoutArgs& rArgs )
: ServerFontLayout( rFont ),
mrPrinterGfx( rGfx )
{
mnFontID = mrPrinterGfx.GetFontID();
mnFontHeight = mrPrinterGfx.GetFontHeight();
mnFontWidth = mrPrinterGfx.GetFontWidth();
mbVertical = mrPrinterGfx.GetFontVertical();
mbArtItalic = mrPrinterGfx.GetArtificialItalic();
mbArtBold = mrPrinterGfx.GetArtificialBold();
const sal_Unicode *pStr = rArgs.mrStr.getStr();
maText = OUString( pStr + rArgs.mnMinCharPos, rArgs.mnEndCharPos - rArgs.mnMinCharPos+1 );
mnMinCharPos = rArgs.mnMinCharPos;
}
void PspServerFontLayout::InitFont() const
{
mrPrinterGfx.SetFont( mnFontID, mnFontHeight, mnFontWidth,
mnOrientation, mbVertical, mbArtItalic, mbArtBold );
}
class PspCommonSalLayout : public CommonSalLayout
{
public:
......@@ -718,7 +676,7 @@ void PspCommonSalLayout::InitFont() const
mnOrientation, mbVertical, mbArtItalic, mbArtBold);
}
static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx, bool bIsPspServerFontLayout )
static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx)
{
const int nMaxGlyphs = 1;
sal_GlyphId aGlyphAry[ nMaxGlyphs ];
......@@ -732,16 +690,6 @@ static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx
const sal_Unicode* pText = nullptr;
int nMinCharPos = 0;
int nMaxCharPos = 0;
if (bIsPspServerFontLayout)
{
const PspServerFontLayout * pPspLayout = dynamic_cast<const PspServerFontLayout*>(&rLayout);
if (pPspLayout)
{
pText = pPspLayout->getTextPtr();
nMinCharPos = pPspLayout->getMinCharPos();
nMaxCharPos = pPspLayout->getMaxCharPos();
}
}
for( int nStart = 0;; )
{
int nGlyphCount = rLayout.GetNextGlyphs( nMaxGlyphs, aGlyphAry, aPos, nStart, aWidthAry, pText ? aCharPosAry : nullptr );
......@@ -773,18 +721,18 @@ void PspFontLayout::InitFont() const
void PspFontLayout::DrawText( SalGraphics& ) const
{
DrawPrinterLayout( *this, mrPrinterGfx, false );
DrawPrinterLayout(*this, mrPrinterGfx);
}
void GenPspGraphics::DrawServerFontLayout( const GenericSalLayout& rLayout, const FreetypeFont& /*unused*/ )
{
// print complex text
DrawPrinterLayout( rLayout, *m_pPrinterGfx, true );
DrawPrinterLayout(rLayout, *m_pPrinterGfx);
}
void GenPspGraphics::DrawSalLayout(const CommonSalLayout& rLayout)
{
DrawPrinterLayout(rLayout, *m_pPrinterGfx, false);
DrawPrinterLayout(rLayout, *m_pPrinterGfx);
}
const FontCharMapRef GenPspGraphics::GetFontCharMap() const
......@@ -1012,10 +960,7 @@ SalLayout* GenPspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
if( m_pFreetypeFont[ nFallbackLevel ]
&& !(rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing) )
{
if (SalLayout::UseCommonLayout())
pLayout = new PspCommonSalLayout(*m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel]);
else
pLayout = new PspServerFontLayout( *m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel], rArgs );
pLayout = new PspCommonSalLayout(*m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel]);
}
else
pLayout = new PspFontLayout( *m_pPrinterGfx );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment