diff options
author | Andre Fischer <af@openoffice.org> | 2010-07-14 15:54:26 +0200 |
---|---|---|
committer | Andre Fischer <af@openoffice.org> | 2010-07-14 15:54:26 +0200 |
commit | a7b3942c0f04f24455ab85ec0c0a8c2a0014da0f (patch) | |
tree | 2c95d3537d96d0c56dad2efbaea0cab37f852bc1 | |
parent | be588658ea127a6a05390435126f1d739a477b58 (diff) |
impress195: #i64671# Fixed font pitch processing.
-rw-r--r-- | canvas/source/cairo/cairo_canvasfont.cxx | 5 | ||||
-rwxr-xr-x | canvas/source/directx/dx_textlayout_drawhelper.cxx | 7 | ||||
-rw-r--r-- | canvas/source/vcl/canvasfont.cxx | 5 | ||||
-rw-r--r-- | cppcanvas/inc/cppcanvas/renderer.hxx | 3 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/implrenderer.cxx | 10 |
5 files changed, 29 insertions, 1 deletions
diff --git a/canvas/source/cairo/cairo_canvasfont.cxx b/canvas/source/cairo/cairo_canvasfont.cxx index 452280728151..a083d2d4a82f 100644 --- a/canvas/source/cairo/cairo_canvasfont.cxx +++ b/canvas/source/cairo/cairo_canvasfont.cxx @@ -30,6 +30,8 @@ #include <canvas/debug.hxx> +#include <com/sun/star/rendering/PanoseProportion.hpp> + #include <rtl/math.hxx> #include <basegfx/numeric/ftools.hxx> @@ -83,6 +85,9 @@ namespace cairocanvas // TODO(F2): improve panose->vclenum conversion maFont->SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) ); maFont->SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL ); + maFont->SetPitch( + rFontRequest.FontDescription.FontDescription.Proportion == rendering::PanoseProportion::MONO_SPACED + ? PITCH_FIXED : PITCH_VARIABLE); maFont->SetLanguage(MsLangId::convertLocaleToLanguage(rFontRequest.Locale)); diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index 56ec00e9a648..0cb20a096c18 100755 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -39,6 +39,7 @@ #include <boost/scoped_array.hpp> #include <boost/bind.hpp> #include <com/sun/star/rendering/FontRequest.hpp> +#include <com/sun/star/rendering/PanoseProportion.hpp> #include <com/sun/star/rendering/XCanvasFont.hpp> #include <comphelper/sequence.hxx> #include <comphelper/scopeguard.hxx> @@ -132,6 +133,9 @@ namespace dxcanvas aFont.SetVertical( (rFontRequest.FontDescription.IsVertical==com::sun::star::util::TriState_YES) ? TRUE : FALSE ); aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) ); aFont.SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL ); + aFont.SetPitch( + rFontRequest.FontDescription.FontDescription.Proportion == rendering::PanoseProportion::MONO_SPACED + ? PITCH_FIXED : PITCH_VARIABLE); aFont.SetLanguage(MsLangId::convertLocaleToLanguage(rFontRequest.Locale)); @@ -264,6 +268,9 @@ namespace dxcanvas aFont.SetVertical( (rFontRequest.FontDescription.IsVertical==com::sun::star::util::TriState_YES) ? TRUE : FALSE ); aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) ); aFont.SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL ); + aFont.SetPitch( + rFontRequest.FontDescription.FontDescription.Proportion == rendering::PanoseProportion::MONO_SPACED + ? PITCH_FIXED : PITCH_VARIABLE); // adjust to stretched font if(!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11)) diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx index e95a3f79f2b5..302254acdcab 100644 --- a/canvas/source/vcl/canvasfont.cxx +++ b/canvas/source/vcl/canvasfont.cxx @@ -35,6 +35,8 @@ #include <i18npool/mslangid.hxx> #include <vcl/metric.hxx> +#include <com/sun/star/rendering/PanoseProportion.hpp> + #include "canvasfont.hxx" #include "textlayout.hxx" @@ -63,6 +65,9 @@ namespace vclcanvas // TODO(F2): improve panose->vclenum conversion maFont->SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) ); maFont->SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL ); + maFont->SetPitch( + rFontRequest.FontDescription.FontDescription.Proportion == rendering::PanoseProportion::MONO_SPACED + ? PITCH_FIXED : PITCH_VARIABLE); maFont->SetLanguage(MsLangId::convertLocaleToLanguage(rFontRequest.Locale)); diff --git a/cppcanvas/inc/cppcanvas/renderer.hxx b/cppcanvas/inc/cppcanvas/renderer.hxx index 780a27f31503..12d97e075317 100644 --- a/cppcanvas/inc/cppcanvas/renderer.hxx +++ b/cppcanvas/inc/cppcanvas/renderer.hxx @@ -136,6 +136,9 @@ namespace cppcanvas /// Optionally forces the given font letter form (italics etc.) for all text actions ::comphelper::OptionalValue< sal_Int8 > maFontLetterForm; + /// Optionally forces the given font proportion (condensed, monospaced etc.) for all text actions + ::comphelper::OptionalValue< sal_Int8 > maFontProportion; + /// Optionally forces underlining for all text actions ::comphelper::OptionalValue< bool > maFontUnderline; }; diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 1423cd42ed93..7ac049e43660 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/rendering/TexturingMode.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/geometry/RealPoint2D.hpp> +#include <com/sun/star/rendering/PanoseProportion.hpp> #include <com/sun/star/rendering/ViewState.hpp> #include <com/sun/star/rendering/RenderState.hpp> #include <com/sun/star/rendering/XCanvasFont.hpp> @@ -850,6 +851,12 @@ namespace cppcanvas rParms.mrParms.maFontLetterForm.isValid() ? rParms.mrParms.maFontLetterForm.getValue() : (rFont.GetItalic() == ITALIC_NONE) ? 0 : 9; + aFontRequest.FontDescription.FontDescription.Proportion = + rParms.mrParms.maFontProportion.isValid() ? + rParms.mrParms.maFontProportion.getValue() : + (rFont.GetPitch() == PITCH_FIXED) + ? rendering::PanoseProportion::MONO_SPACED + : rendering::PanoseProportion::ANYTHING; LanguageType aLang = rFont.GetLanguage(); aFontRequest.Locale = MsLangId::convertLanguageToLocale(aLang, false); @@ -2967,7 +2974,8 @@ namespace cppcanvas if( rParams.maFontName.isValid() || rParams.maFontWeight.isValid() || rParams.maFontLetterForm.isValid() || - rParams.maFontUnderline.isValid() ) + rParams.maFontUnderline.isValid() || + rParams.maFontProportion.isValid() ) { ::cppcanvas::internal::OutDevState& rState = getState( aStateStack ); |