/[packages]/cauldron/libreoffice/releases/3.3.1.2/7.mga1/SOURCES/0001-Resolves-rhbz-680460-honour-lcdfilter-subpixeling-et.patch
ViewVC logotype

Contents of /cauldron/libreoffice/releases/3.3.1.2/7.mga1/SOURCES/0001-Resolves-rhbz-680460-honour-lcdfilter-subpixeling-et.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 389214 - (show annotations) (download)
Thu Jan 17 21:30:27 2013 UTC (11 years, 3 months ago) by pterjan
File size: 9594 byte(s)
oops
1 From 5aab60551b825b3ad283f19263f3ce549c725055 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
3 Date: Wed, 16 Mar 2011 15:47:14 +0000
4 Subject: [PATCH] Resolves: rhbz#680460 honour lcdfilter, subpixeling etc.
5
6 ---
7 vcl/inc/vcl/glyphcache.hxx | 1 +
8 vcl/inc/vcl/impfont.hxx | 2 +
9 vcl/source/glyphs/gcach_ftyp.cxx | 5 +++
10 vcl/source/glyphs/gcach_ftyp.hxx | 1 +
11 vcl/unx/source/fontmanager/fontconfig.cxx | 41 +++++++++++++++++++++++++---
12 vcl/unx/source/gdi/salgdi3.cxx | 20 ++++++++++----
13 6 files changed, 59 insertions(+), 11 deletions(-)
14
15 diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx
16 index 1c03759..035fd5c 100644
17 --- a/vcl/inc/vcl/glyphcache.hxx
18 +++ b/vcl/inc/vcl/glyphcache.hxx
19 @@ -188,6 +188,7 @@ public:
20 virtual void* GetFtFace() const { return 0; }
21 virtual int GetLoadFlags() const { return 0; }
22 virtual void SetFontOptions( const ImplFontOptions*) {}
23 + virtual const ImplFontOptions* GetFontOptions() const { return 0; }
24 virtual bool NeedsArtificialBold() const { return false; }
25 virtual bool NeedsArtificialItalic() const { return false; }
26
27 diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx
28 index fa8a837..ed9c35c 100644
29 --- a/vcl/inc/vcl/impfont.hxx
30 +++ b/vcl/inc/vcl/impfont.hxx
31 @@ -166,6 +166,8 @@ public:
32 { return meAntiAlias == ANTIALIAS_FALSE; }
33 bool DontUseHinting() const
34 { return (meHinting == HINTING_FALSE) || (GetHintStyle() == HINT_NONE); }
35 + virtual void *GetPattern(void * /*pFace*/) const
36 + { return NULL; }
37 };
38
39 // -------------------
40 diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
41 index a6a13da..8c46009 100644
42 --- a/vcl/source/glyphs/gcach_ftyp.cxx
43 +++ b/vcl/source/glyphs/gcach_ftyp.cxx
44 @@ -967,6 +967,11 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions* pFontOptions)
45 mnLoadFlags |= FT_LOAD_NO_BITMAP;
46 }
47
48 +const ImplFontOptions* FreetypeServerFont::GetFontOptions() const
49 +{
50 + return mpFontOptions;
51 +}
52 +
53 // -----------------------------------------------------------------------
54
55 bool FreetypeServerFont::TestFont() const
56 diff --git a/vcl/source/glyphs/gcach_ftyp.hxx b/vcl/source/glyphs/gcach_ftyp.hxx
57 index 6069388..1df8253 100644
58 --- a/vcl/source/glyphs/gcach_ftyp.hxx
59 +++ b/vcl/source/glyphs/gcach_ftyp.hxx
60 @@ -187,6 +187,7 @@ public:
61 virtual bool TestFont() const;
62 virtual void* GetFtFace() const;
63 virtual void SetFontOptions( const ImplFontOptions*);
64 + virtual const ImplFontOptions* GetFontOptions() const;
65 virtual int GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); }
66 virtual bool NeedsArtificialBold() const { return mbArtBold; }
67 virtual bool NeedsArtificialItalic() const { return mbArtItalic; }
68 diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
69 index 92632c7..7b792d3 100644
70 --- a/vcl/unx/source/fontmanager/fontconfig.cxx
71 +++ b/vcl/unx/source/fontmanager/fontconfig.cxx
72 @@ -56,6 +56,9 @@
73 #define FC_HINT_MEDIUM 2
74 #define FC_HINT_FULL 3
75 #endif
76 + #ifndef FC_FT_FACE
77 + #define FC_FT_FACE "ftface"
78 + #endif
79 #else
80 typedef void FcConfig;
81 typedef void FcObjectSet;
82 @@ -136,6 +139,7 @@
83 FcBool (*m_pFcPatternAddCharSet)(FcPattern*,const char*,const FcCharSet*);
84 FcBool (*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*);
85 FT_UInt (*m_pFcFreeTypeCharIndex)(FT_Face,FcChar32);
86 + FcBool (*m_pFcPatternAddFTFace)(FcPattern*,const char*,const FT_Face);
87
88 oslGenericFunction loadSymbol( const char* );
89 void addFontSet( FcSetName );
90 @@ -250,6 +254,13 @@
91 FT_UInt FcFreeTypeCharIndex( FT_Face face, FcChar32 ucs4 )
92 { return m_pFcFreeTypeCharIndex ? m_pFcFreeTypeCharIndex( face, ucs4 ) : 0; }
93
94 + FcBool FcPatternAddFTFace( FcPattern* pPattern, const char* pObject, const FT_Face nValue )
95 + {
96 + return m_pFcPatternAddFTFace
97 + ? m_pFcPatternAddFTFace( pPattern, pObject, nValue )
98 + : false;
99 + }
100 +
101 public: // TODO: cleanup
102 FcResult FamilyFromPattern(FcPattern* pPattern, FcChar8 **family);
103 std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aFontNameToLocalized;
104 @@ -355,6 +366,8 @@
105 loadSymbol( "FcPatternAddString" );
106 m_pFcFreeTypeCharIndex = (FT_UInt(*)(FT_Face,FcChar32))
107 loadSymbol( "FcFreeTypeCharIndex" );
108 + m_pFcPatternAddFTFace = (FcBool(*)(FcPattern*,const char*,const FT_Face))
109 + loadSymbol( "FcPatternAddFTFace" );
110
111 m_nFcVersion = FcGetVersion();
112 #if (OSL_DEBUG_LEVEL > 1)
113 @@ -1200,6 +1213,26 @@
114 return aName;
115 }
116
117 +class FontConfigFontOptions : public ImplFontOptions
118 +{
119 +public:
120 + FontConfigFontOptions() : mpPattern(0) {}
121 + ~FontConfigFontOptions()
122 + {
123 + FontCfgWrapper& rWrapper = FontCfgWrapper::get();
124 + if( rWrapper.isValid() )
125 + rWrapper.FcPatternDestroy( mpPattern );
126 + }
127 + virtual void *GetPattern(void * face) const
128 + {
129 + FontCfgWrapper& rWrapper = FontCfgWrapper::get();
130 + if( rWrapper.isValid() )
131 + rWrapper.FcPatternAddFTFace(mpPattern, FC_FT_FACE, static_cast<FT_Face>(face));
132 + return mpPattern;
133 + }
134 + FcPattern* mpPattern;
135 +};
136 +
137 ImplFontOptions* PrintFontManager::getFontOptions(
138 const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*)) const
139 {
140 @@ -1210,7 +1243,7 @@
141 if( ! rWrapper.isValid() )
142 return NULL;
143
144 - ImplFontOptions *pOptions = NULL;
145 + FontConfigFontOptions* pOptions = NULL;
146 FcConfig* pConfig = rWrapper.FcConfigGetCurrent();
147 FcPattern* pPattern = rWrapper.FcPatternCreate();
148
149 @@ -1247,9 +1280,10 @@
150 FC_HINTING, 0, &hinting);
151 /*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger(pResult,
152 FC_HINT_STYLE, 0, &hintstyle);
153 - rWrapper.FcPatternDestroy(pResult);
154
155 - pOptions = new ImplFontOptions;
156 + pOptions = new FontConfigFontOptions;
157 +
158 + pOptions->mpPattern = pResult;
159
160 if( eEmbeddedBitmap == FcResultMatch )
161 pOptions->meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE;
162 diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
163 index 6de93fe..a0bef90 100644
164 --- a/vcl/unx/source/gdi/salgdi3.cxx
165 +++ b/vcl/unx/source/gdi/salgdi3.cxx
166 @@ -89,7 +89,6 @@ struct cairo_surface_t;
167 struct cairo_t;
168 struct cairo_font_face_t;
169 typedef void* FT_Face;
170 -typedef void* FcPattern;
171 struct cairo_matrix_t {
172 double xx; double yx;
173 double xy; double yy;
174 @@ -742,7 +741,7 @@ private:
175 void (*mp_clip)(cairo_t*);
176 void (*mp_rectangle)(cairo_t*, double, double, double, double);
177 cairo_font_face_t * (*mp_ft_font_face_create_for_ft_face)(FT_Face, int);
178 - cairo_font_face_t * (*mp_ft_font_face_create_for_pattern)(FcPattern*);
179 + cairo_font_face_t * (*mp_ft_font_face_create_for_pattern)(void*);
180 void (*mp_set_font_face)(cairo_t *, cairo_font_face_t *);
181 void (*mp_font_face_destroy)(cairo_font_face_t *);
182 void (*mp_matrix_init_identity)(cairo_matrix_t *);
183 @@ -772,8 +771,12 @@ public:
184 { (*mp_rectangle)(cr, x, y, width, height); }
185 cairo_font_face_t* ft_font_face_create_for_ft_face(FT_Face face, int load_flags)
186 { return (*mp_ft_font_face_create_for_ft_face)(face, load_flags); }
187 - cairo_font_face_t* ft_font_face_create_for_pattern(FcPattern *pattern)
188 - { return (*mp_ft_font_face_create_for_pattern)(pattern); }
189 + cairo_font_face_t* ft_font_face_create_for_pattern(void *pattern)
190 + {
191 + return mp_ft_font_face_create_for_pattern
192 + ? (*mp_ft_font_face_create_for_pattern)(pattern)
193 + : NULL;
194 + }
195 void set_font_face(cairo_t *cr, cairo_font_face_t *font_face)
196 { (*mp_set_font_face)(cr, font_face); }
197 void font_face_destroy(cairo_font_face_t *font_face)
198 @@ -847,7 +850,7 @@ CairoWrapper::CairoWrapper()
199 osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_rectangle" );
200 mp_ft_font_face_create_for_ft_face = (cairo_font_face_t * (*)(FT_Face, int))
201 osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_ft_face" );
202 - mp_ft_font_face_create_for_pattern = (cairo_font_face_t * (*)(FcPattern*))
203 + mp_ft_font_face_create_for_pattern = (cairo_font_face_t * (*)(void*))
204 osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_pattern" );
205 mp_set_font_face = (void (*)(cairo_t *, cairo_font_face_t *))
206 osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_face" );
207 @@ -1016,7 +1019,12 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
208 font_face = (cairo_font_face_t*)m_aCairoFontsCache.FindCachedFont(pId);
209 if (!font_face)
210 {
211 - font_face = rCairo.ft_font_face_create_for_ft_face(pId, rFont.GetLoadFlags());
212 + const ImplFontOptions *pOptions = rFont.GetFontOptions();
213 + void *pPattern = pOptions ? pOptions->GetPattern(pId) : NULL;
214 + if (pPattern)
215 + font_face = rCairo.ft_font_face_create_for_pattern(pPattern);
216 + if (!font_face)
217 + font_face = rCairo.ft_font_face_create_for_ft_face(pId, rFont.GetLoadFlags());
218 m_aCairoFontsCache.CacheFont(font_face, pId);
219 }
220
221 --
222 1.7.4.1
223

  ViewVC Help
Powered by ViewVC 1.1.30