-rw-r--r-- | noncore/unsupported/qpdf/QOutputDev.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/noncore/unsupported/qpdf/QOutputDev.cpp b/noncore/unsupported/qpdf/QOutputDev.cpp index 15a58b1..f587a33 100644 --- a/noncore/unsupported/qpdf/QOutputDev.cpp +++ b/noncore/unsupported/qpdf/QOutputDev.cpp | |||
@@ -136,98 +136,96 @@ QFont QOutputDev::matchFont ( GfxFont *gfxFont, fp_t m11, fp_t m12, fp_t m21, fp | |||
136 | f. setBold ( subst-> m_bold ); | 136 | f. setBold ( subst-> m_bold ); |
137 | f. setItalic ( subst-> m_italic ); | 137 | f. setItalic ( subst-> m_italic ); |
138 | } | 138 | } |
139 | else { | 139 | else { |
140 | QFont::StyleHint sty; | 140 | QFont::StyleHint sty; |
141 | 141 | ||
142 | if ( gfxFont-> isSerif ( )) | 142 | if ( gfxFont-> isSerif ( )) |
143 | sty = QFont::Serif; | 143 | sty = QFont::Serif; |
144 | else if ( gfxFont-> isFixedWidth ( )) | 144 | else if ( gfxFont-> isFixedWidth ( )) |
145 | sty = QFont::TypeWriter; | 145 | sty = QFont::TypeWriter; |
146 | else | 146 | else |
147 | sty = QFont::Helvetica; | 147 | sty = QFont::Helvetica; |
148 | 148 | ||
149 | f. setStyleHint ( sty, (QFont::StyleStrategy) ( QFont::PreferOutline | QFont::PreferQuality )); | 149 | f. setStyleHint ( sty, (QFont::StyleStrategy) ( QFont::PreferOutline | QFont::PreferQuality )); |
150 | f. setBold ( gfxFont-> isBold ( ) > 0 ); | 150 | f. setBold ( gfxFont-> isBold ( ) > 0 ); |
151 | f. setItalic ( gfxFont-> isItalic ( ) > 0 ); | 151 | f. setItalic ( gfxFont-> isItalic ( ) > 0 ); |
152 | f. setFixedPitch ( gfxFont-> isFixedWidth ( ) > 0 ); | 152 | f. setFixedPitch ( gfxFont-> isFixedWidth ( ) > 0 ); |
153 | 153 | ||
154 | // common specifiers in font names | 154 | // common specifiers in font names |
155 | if ( fname. contains ( "Oblique" ) || fname. contains ( "Italic" )) | 155 | if ( fname. contains ( "Oblique" ) || fname. contains ( "Italic" )) |
156 | f. setItalic ( true ); | 156 | f. setItalic ( true ); |
157 | if ( fname. contains ( "Bold" )) | 157 | if ( fname. contains ( "Bold" )) |
158 | f. setWeight ( QFont::Bold ); | 158 | f. setWeight ( QFont::Bold ); |
159 | if ( fname. contains ( "Demi" )) | 159 | if ( fname. contains ( "Demi" )) |
160 | f. setWeight ( QFont::DemiBold ); | 160 | f. setWeight ( QFont::DemiBold ); |
161 | if ( fname. contains ( "Light" )) | 161 | if ( fname. contains ( "Light" )) |
162 | f. setWeight ( QFont::Light ); | 162 | f. setWeight ( QFont::Light ); |
163 | if ( fname. contains ( "Black" )) | 163 | if ( fname. contains ( "Black" )) |
164 | f. setWeight ( QFont::Black ); | 164 | f. setWeight ( QFont::Black ); |
165 | } | 165 | } |
166 | // Treat x-sheared fonts as italic | 166 | // Treat x-sheared fonts as italic |
167 | if (( m12 > -0.1 ) && ( m12 < 0.1 ) && ((( m21 > -5.0 ) && ( m21 < -0.1 )) || (( m21 > 0.1 ) && ( m21 < 5.0 )))) { | 167 | if (( m12 > -0.1 ) && ( m12 < 0.1 ) && ((( m21 > -5.0 ) && ( m21 < -0.1 )) || (( m21 > 0.1 ) && ( m21 < 5.0 )))) { |
168 | f. setItalic ( true ); | 168 | f. setItalic ( true ); |
169 | } | 169 | } |
170 | return f; | 170 | return f; |
171 | } | 171 | } |
172 | 172 | ||
173 | 173 | ||
174 | 174 | ||
175 | //------------------------------------------------------------------------ | 175 | //------------------------------------------------------------------------ |
176 | // QOutputDev | 176 | // QOutputDev |
177 | //------------------------------------------------------------------------ | 177 | //------------------------------------------------------------------------ |
178 | 178 | ||
179 | QOutputDev::QOutputDev ( QWidget *parent, const char *name, int flags ) : QScrollView ( parent, name, WRepaintNoErase | WResizeNoErase | flags ) | 179 | QOutputDev::QOutputDev ( QWidget *parent, const char *name, int flags ) : QScrollView ( parent, name, WRepaintNoErase | WResizeNoErase | flags ) |
180 | { | 180 | { |
181 | m_pixmap = 0; | 181 | m_pixmap = 0; |
182 | m_painter = 0; | 182 | m_painter = 0; |
183 | 183 | ||
184 | m_use_string = true; | ||
185 | |||
186 | // create text object | 184 | // create text object |
187 | m_text = new TextPage ( gFalse ); | 185 | m_text = new TextPage ( gFalse ); |
188 | } | 186 | } |
189 | 187 | ||
190 | QOutputDev::~QOutputDev ( ) | 188 | QOutputDev::~QOutputDev ( ) |
191 | { | 189 | { |
192 | delete m_painter; | 190 | delete m_painter; |
193 | delete m_pixmap; | 191 | delete m_pixmap; |
194 | delete m_text; | 192 | delete m_text; |
195 | } | 193 | } |
196 | 194 | ||
197 | 195 | ||
198 | void QOutputDev::startPage ( int /*pageNum*/, GfxState *state ) | 196 | void QOutputDev::startPage ( int /*pageNum*/, GfxState *state ) |
199 | { | 197 | { |
200 | delete m_pixmap; | 198 | delete m_pixmap; |
201 | delete m_painter; | 199 | delete m_painter; |
202 | 200 | ||
203 | m_pixmap = new QPixmap ( lrint ( state-> getPageWidth ( )), lrint ( state-> getPageHeight ( ))); | 201 | m_pixmap = new QPixmap ( lrint ( state-> getPageWidth ( )), lrint ( state-> getPageHeight ( ))); |
204 | m_painter = new QPainter ( m_pixmap ); | 202 | m_painter = new QPainter ( m_pixmap ); |
205 | 203 | ||
206 | QPDFDBG( printf ( "NEW PIXMAP (%ld x %ld)\n", lrint ( state-> getPageWidth ( )), lrint ( state-> getPageHeight ( )))); | 204 | QPDFDBG( printf ( "NEW PIXMAP (%ld x %ld)\n", lrint ( state-> getPageWidth ( )), lrint ( state-> getPageHeight ( )))); |
207 | 205 | ||
208 | resizeContents ( m_pixmap-> width ( ), m_pixmap-> height ( )); | 206 | resizeContents ( m_pixmap-> width ( ), m_pixmap-> height ( )); |
209 | setContentsPos ( 0, 0 ); | 207 | setContentsPos ( 0, 0 ); |
210 | 208 | ||
211 | m_pixmap-> fill ( white ); // clear window | 209 | m_pixmap-> fill ( white ); // clear window |
212 | m_text-> clear ( ); // cleat text object | 210 | m_text-> clear ( ); // cleat text object |
213 | viewport ( )-> repaint ( ); | 211 | viewport ( )-> repaint ( ); |
214 | } | 212 | } |
215 | 213 | ||
216 | void QOutputDev::endPage ( ) | 214 | void QOutputDev::endPage ( ) |
217 | { | 215 | { |
218 | m_text-> coalesce ( ); | 216 | m_text-> coalesce ( ); |
219 | 217 | ||
220 | delete m_painter; | 218 | delete m_painter; |
221 | m_painter = 0; | 219 | m_painter = 0; |
222 | 220 | ||
223 | updateContents ( 0, 0, contentsWidth ( ), contentsHeight ( )); | 221 | updateContents ( 0, 0, contentsWidth ( ), contentsHeight ( )); |
224 | } | 222 | } |
225 | 223 | ||
226 | void QOutputDev::drawLink ( Link *link, Catalog */*catalog*/ ) | 224 | void QOutputDev::drawLink ( Link *link, Catalog */*catalog*/ ) |
227 | { | 225 | { |
228 | fp_t x1, y1, x2, y2, w; | 226 | fp_t x1, y1, x2, y2, w; |
229 | 227 | ||
230 | link-> getBorder ( &x1, &y1, &x2, &y2, &w ); | 228 | link-> getBorder ( &x1, &y1, &x2, &y2, &w ); |
231 | 229 | ||
232 | if ( w > 0 ) { | 230 | if ( w > 0 ) { |
233 | int x, y, dx, dy; | 231 | int x, y, dx, dy; |