summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 522aa9b)
raw | patch | inline | side by side (parent: 522aa9b)
author | miklosh <miklosh@users.sourceforge.net> | |
Fri, 17 Aug 2007 12:36:23 +0000 (12:36 +0000) | ||
committer | miklosh <miklosh@users.sourceforge.net> | |
Fri, 17 Aug 2007 12:36:23 +0000 (12:36 +0000) |
src/extension/internal/pdfinput/pdf-parser.cpp | patch | blob | history | |
src/extension/internal/pdfinput/svg-builder.cpp | patch | blob | history |
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index d27d4dab42cf3acbf963ca35e3f9b264f219dc55..9233361b2ea2263121fa2b55bb10e98bc04bb6a2 100644 (file)
void PdfParser::opSetHorizScaling(Object args[], int numArgs) {
state->setHorizScaling(args[0].getNum());
+ builder->updateTextMatrix(state);
fontChanged = gTrue;
}
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index 28da78d0921d1c92db53c885ce6a7f68865c3b6f..14f9c610280b5b911a9ff53be29ce58a05c41b5c 100644 (file)
TRACE(("updateFont()\n"));
_need_font_update = false;
+ updateTextMatrix(state); // Ensure that we have a text matrix built
if (_font_style) {
//sp_repr_css_attr_unref(_font_style);
// Font size
Inkscape::CSSOStringStream os_font_size;
- double *text_matrix = state->getTextMat();
- double w_scale = sqrt( text_matrix[0] * text_matrix[0] + text_matrix[2] * text_matrix[2] );
- double h_scale = sqrt( text_matrix[1] * text_matrix[1] + text_matrix[3] * text_matrix[3] );
- double max_scale;
- if ( w_scale > h_scale ) {
- max_scale = w_scale;
- } else {
- max_scale = h_scale;
- }
- double css_font_size = max_scale * state->getFontSize();
+ double css_font_size = _font_scaling * state->getFontSize();
if ( font->getType() == fontType3 ) {
double *font_matrix = font->getFontMatrix();
if ( font_matrix[0] != 0.0 ) {
css_font_size *= font_matrix[3] / font_matrix[0];
}
}
-
os_font_size << css_font_size;
sp_repr_css_set_property(_font_style, "font-size", os_font_size.str().c_str());
sp_repr_css_set_property(_font_style, "writing-mode", "tb");
}
- // Calculate new text matrix
- NR::Matrix new_text_matrix(text_matrix[0] * state->getHorizScaling(),
- text_matrix[1] * state->getHorizScaling(),
- -text_matrix[2], -text_matrix[3],
- 0.0, 0.0);
-
- if ( fabs( max_scale - 1.0 ) > EPSILON ) {
- // Cancel out scaling by font size in text matrix
- for ( int i = 0 ; i < 4 ; i++ ) {
- new_text_matrix[i] /= max_scale;
- }
- }
- _text_matrix = new_text_matrix;
- _font_scaling = max_scale;
_current_font = font;
_invalidated_style = true;
}
*/
void SvgBuilder::updateTextMatrix(GfxState *state) {
_flushText();
- updateFont(state); // Update text matrix
+ // Update text matrix
+ double *text_matrix = state->getTextMat();
+ double w_scale = sqrt( text_matrix[0] * text_matrix[0] + text_matrix[2] * text_matrix[2] );
+ double h_scale = sqrt( text_matrix[1] * text_matrix[1] + text_matrix[3] * text_matrix[3] );
+ double max_scale;
+ if ( w_scale > h_scale ) {
+ max_scale = w_scale;
+ } else {
+ max_scale = h_scale;
+ }
+ // Calculate new text matrix
+ NR::Matrix new_text_matrix(text_matrix[0] * state->getHorizScaling(),
+ text_matrix[1] * state->getHorizScaling(),
+ -text_matrix[2], -text_matrix[3],
+ 0.0, 0.0);
+
+ if ( fabs( max_scale - 1.0 ) > EPSILON ) {
+ // Cancel out scaling by font size in text matrix
+ for ( int i = 0 ; i < 4 ; i++ ) {
+ new_text_matrix[i] /= max_scale;
+ }
+ }
+ _text_matrix = new_text_matrix;
+ _font_scaling = max_scale;
}
/**