void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y,
wxCoord width, wxCoord height)
{
- double r = 4 * (sqrt (2) - 1) / 3;
+ double r = 4 * (sqrt(2.) - 1) / 3;
double halfW = 0.5 * width,
halfH = 0.5 * height,
halfWR = r * halfW,
bool underlined = m_font.Ok() && m_font.GetUnderlined();
-#if wxUSE_UNICODE
- const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
+ // FIXME-UTF8: wouldn't be needed if utf8_str() always returned a buffer
+#if wxUSE_UNICODE_UTF8
+ const char *data = text.utf8_str();
#else
- const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
- if ( !wdata )
- return;
- const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
+ const wxCharBuffer data = text.utf8_str();
#endif
- size_t datalen = strlen((const char*)data);
- pango_layout_set_text( m_layout, (const char*) data, datalen);
+ size_t datalen = strlen(data);
+ pango_layout_set_text( m_layout, data, datalen);
if (underlined)
{
void wxGnomePrintDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
+ wxDC::DoSetClippingRegion( x, y, width, height );
+
gs_lgp->gnome_print_gsave( m_gpc );
gs_lgp->gnome_print_newpath( m_gpc );
void wxGnomePrintDC::DestroyClippingRegion()
{
+ wxDC::DestroyClippingRegion();
+
gs_lgp->gnome_print_grestore( m_gpc );
#if 0
pango_layout_set_font_description( m_layout, theFont->GetNativeFontInfo()->description );
// Set layout's text
-#if wxUSE_UNICODE
- const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
- const char *dataUTF8 = (const char *)data;
+
+ // FIXME-UTF8: wouldn't be needed if utf8_str() always returned a buffer
+#if wxUSE_UNICODE_UTF8
+ const char *dataUTF8 = string.utf8_str();
#else
- const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
- if ( !wdata )
- {
- if (width) (*width) = 0;
- if (height) (*height) = 0;
- return;
- }
- const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
- const char *dataUTF8 = (const char *)data;
+ const wxCharBuffer dataUTF8 = string.utf8_str();
#endif
- if ( !dataUTF8 )
- {
- // hardly ideal, but what else can we do if conversion failed?
- return;
- }
+ PangoFontDescription *desc = (theFont) ? theFont->GetNativeFontInfo()->description : m_fontdesc;
+
+ gint oldSize = pango_font_description_get_size( desc );
+ double size = oldSize;
+ size = size * m_scaleY;
+ pango_font_description_set_size( desc, (gint)size );
+
+ // apply scaled font
+ pango_layout_set_font_description( m_layout, desc );
pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) );
- int w,h;
+ int w, h;
pango_layout_get_pixel_size( m_layout, &w, &h );
+
if (width)
*width = (wxCoord)(w / m_scaleX);
if (height)
*height = (wxCoord)(h / m_scaleY);
+
if (descent)
{
PangoLayoutIter *iter = pango_layout_get_iter(m_layout);
*descent = h - PANGO_PIXELS(baseline);
}
- // Reset old font description
- if (theFont)
- pango_layout_set_font_description( m_layout, m_fontdesc );
+ // reset unscaled size
+ pango_font_description_set_size( desc, oldSize );
+
+ // reset unscaled font
+ pango_layout_set_font_description( m_layout, m_fontdesc );
}
void wxGnomePrintDC::DoGetSize(int* width, int* height) const