Lots of Pango etc up-ports from HEAD.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19179 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -254,7 +254,7 @@ static char wxPostScriptHeaderReencodeISO2[] =
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
|
||||||
|
|
||||||
float wxPostScriptDC::ms_PSScaleFactor = 10.0;
|
float wxPostScriptDC::ms_PSScaleFactor = 1.0;
|
||||||
|
|
||||||
void wxPostScriptDC::SetResolution(int ppi)
|
void wxPostScriptDC::SetResolution(int ppi)
|
||||||
{
|
{
|
||||||
@@ -1220,10 +1220,14 @@ void draw_bezier_outline(FILE *file,
|
|||||||
|
|
||||||
fprintf(file, "gsave\n");
|
fprintf(file, "gsave\n");
|
||||||
fprintf(file, "%d %d translate\n", pos_x, pos_y );
|
fprintf(file, "%d %d translate\n", pos_x, pos_y );
|
||||||
// FT2 scales outlines to 26.6 pixels so the code below
|
|
||||||
// should read 26600 instead of the 60000.
|
// We have to replace the "," from the German
|
||||||
fprintf(file, "%d 60000 div %d 60000 div scale\n", scale_x, scale_y );
|
// locale with the Englich "." for PostScript
|
||||||
fprintf(file, "0 0 0 setrgbcolor\n");
|
char buf[100];
|
||||||
|
sprintf(buf, "%.8f %.8f scale\n", scale_x, scale_y );
|
||||||
|
for (size_t i = 0; i < strlen(buf); i++)
|
||||||
|
if (buf[i] == ',') buf[i] = '.';
|
||||||
|
fprintf(file, buf);
|
||||||
|
|
||||||
FT_Load_Glyph(face, glyph_index, load_flags);
|
FT_Load_Glyph(face, glyph_index, load_flags);
|
||||||
FT_Get_Glyph (face->glyph, &glyph);
|
FT_Get_Glyph (face->glyph, &glyph);
|
||||||
@@ -1240,78 +1244,6 @@ void wxPostScriptDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
|
wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
|
||||||
|
|
||||||
#if wxUSE_PANGO
|
|
||||||
int dpi = GetResolution();
|
|
||||||
dpi = 300;
|
|
||||||
PangoContext *context = pango_ft2_get_context ( dpi, dpi );
|
|
||||||
|
|
||||||
pango_context_set_language (context, pango_language_from_string ("en_US"));
|
|
||||||
pango_context_set_base_dir (context, PANGO_DIRECTION_LTR );
|
|
||||||
|
|
||||||
pango_context_set_font_description (context, m_font.GetNativeFontInfo()->description );
|
|
||||||
|
|
||||||
PangoLayout *layout = pango_layout_new (context);
|
|
||||||
#if wxUSE_UNICODE
|
|
||||||
wxCharBuffer buffer = wxConvUTF8.cWC2MB( text );
|
|
||||||
#else
|
|
||||||
wxCharBuffer buffer = wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) );
|
|
||||||
#endif
|
|
||||||
pango_layout_set_text( layout, (const char*) buffer, strlen(buffer) );
|
|
||||||
|
|
||||||
PangoRectangle rect;
|
|
||||||
pango_layout_get_extents(layout, NULL, &rect);
|
|
||||||
|
|
||||||
int xx = x * PANGO_SCALE;
|
|
||||||
int yy = y * PANGO_SCALE + (rect.height*2/3);
|
|
||||||
|
|
||||||
int scale_x = LogicalToDeviceXRel( 1000 );
|
|
||||||
int scale_y = LogicalToDeviceYRel( 1000 );
|
|
||||||
|
|
||||||
// Loop over lines in layout
|
|
||||||
int num_lines = pango_layout_get_line_count( layout );
|
|
||||||
for (int i = 0; i < num_lines; i++)
|
|
||||||
{
|
|
||||||
PangoLayoutLine *line = pango_layout_get_line( layout, i );
|
|
||||||
|
|
||||||
// Loop over runs in line
|
|
||||||
GSList *runs_list = line->runs;
|
|
||||||
while (runs_list)
|
|
||||||
{
|
|
||||||
PangoLayoutRun *run = (PangoLayoutRun*) runs_list->data;
|
|
||||||
PangoItem *item = run->item;
|
|
||||||
PangoGlyphString *glyphs = run->glyphs;
|
|
||||||
PangoAnalysis *analysis = &item->analysis;
|
|
||||||
PangoFont *font = analysis->font;
|
|
||||||
FT_Face ft_face = pango_ft2_font_get_face(font);
|
|
||||||
|
|
||||||
int num_glyphs = glyphs->num_glyphs;
|
|
||||||
for (int glyph_idx = 0; glyph_idx < num_glyphs; glyph_idx++)
|
|
||||||
{
|
|
||||||
PangoGlyphGeometry geometry = glyphs->glyphs[glyph_idx].geometry;
|
|
||||||
int pos_x = xx + geometry.x_offset;
|
|
||||||
int pos_y = yy - geometry.y_offset;
|
|
||||||
xx += geometry.width;
|
|
||||||
|
|
||||||
draw_bezier_outline( m_pstream, ft_face,
|
|
||||||
(FT_UInt)(glyphs->glyphs[glyph_idx].glyph),
|
|
||||||
LogicalToDeviceX( pos_x / PANGO_SCALE ),
|
|
||||||
LogicalToDeviceY( pos_y / PANGO_SCALE ),
|
|
||||||
scale_x, scale_y );
|
|
||||||
}
|
|
||||||
runs_list = runs_list->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref( G_OBJECT( layout ) );
|
|
||||||
#else
|
|
||||||
wxCoord text_w, text_h, text_descent;
|
|
||||||
|
|
||||||
GetTextExtent(text, &text_w, &text_h, &text_descent);
|
|
||||||
|
|
||||||
// VZ: this seems to be unnecessary, so taking it out for now, if it
|
|
||||||
// doesn't create any problems, remove this comment entirely
|
|
||||||
//SetFont( m_font );
|
|
||||||
|
|
||||||
if (m_textForegroundColour.Ok())
|
if (m_textForegroundColour.Ok())
|
||||||
{
|
{
|
||||||
unsigned char red = m_textForegroundColour.Red();
|
unsigned char red = m_textForegroundColour.Red();
|
||||||
@@ -1352,6 +1284,90 @@ void wxPostScriptDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_PANGO
|
||||||
|
int ps_dpi = 72;
|
||||||
|
int pango_dpi = 600;
|
||||||
|
PangoContext *context = pango_ft2_get_context ( pango_dpi, pango_dpi );
|
||||||
|
|
||||||
|
double scale = (double)pango_dpi / (double)ps_dpi;
|
||||||
|
scale /= m_userScaleY;
|
||||||
|
|
||||||
|
pango_context_set_language (context, pango_language_from_string ("en_US"));
|
||||||
|
pango_context_set_base_dir (context, PANGO_DIRECTION_LTR );
|
||||||
|
|
||||||
|
pango_context_set_font_description (context, m_font.GetNativeFontInfo()->description );
|
||||||
|
|
||||||
|
PangoLayout *layout = pango_layout_new (context);
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
wxCharBuffer buffer = wxConvUTF8.cWC2MB( text );
|
||||||
|
#else
|
||||||
|
wxCharBuffer buffer = wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) );
|
||||||
|
#endif
|
||||||
|
pango_layout_set_text( layout, (const char*) buffer, strlen(buffer) );
|
||||||
|
|
||||||
|
fprintf( m_pstream, "%%%% %s\n", (const char*)buffer );
|
||||||
|
|
||||||
|
PangoRectangle rect;
|
||||||
|
pango_layout_get_extents(layout, NULL, &rect);
|
||||||
|
|
||||||
|
int xx = LogicalToDeviceX( x );
|
||||||
|
int yy = LogicalToDeviceY( y );
|
||||||
|
|
||||||
|
int xxx = xx * PANGO_SCALE;
|
||||||
|
int yyy = yy * PANGO_SCALE - (int)(rect.height * 0.66 / scale); // Move down by estimated baseline. HACK.
|
||||||
|
|
||||||
|
#define ps_kludge_factor 2.8
|
||||||
|
|
||||||
|
// Loop over lines in layout
|
||||||
|
int num_lines = pango_layout_get_line_count( layout );
|
||||||
|
for (int i = 0; i < num_lines; i++)
|
||||||
|
{
|
||||||
|
PangoLayoutLine *line = pango_layout_get_line( layout, i );
|
||||||
|
|
||||||
|
// width of glyphs already printed
|
||||||
|
int all_width = 0;
|
||||||
|
|
||||||
|
// Loop over runs in line
|
||||||
|
GSList *runs_list = line->runs;
|
||||||
|
while (runs_list)
|
||||||
|
{
|
||||||
|
PangoLayoutRun *run = (PangoLayoutRun*) runs_list->data;
|
||||||
|
PangoItem *item = run->item;
|
||||||
|
PangoGlyphString *glyphs = run->glyphs;
|
||||||
|
PangoAnalysis *analysis = &item->analysis;
|
||||||
|
PangoFont *font = analysis->font;
|
||||||
|
FT_Face ft_face = pango_ft2_font_get_face(font);
|
||||||
|
|
||||||
|
int num_glyphs = glyphs->num_glyphs;
|
||||||
|
for (int glyph_idx = 0; glyph_idx < num_glyphs; glyph_idx++)
|
||||||
|
{
|
||||||
|
PangoGlyphGeometry geometry = glyphs->glyphs[glyph_idx].geometry;
|
||||||
|
int pos_x = xxx + (int)((double)(all_width+geometry.x_offset) / scale);
|
||||||
|
int pos_y = yyy + (int)((double)geometry.y_offset / scale );
|
||||||
|
all_width += geometry.width;
|
||||||
|
|
||||||
|
draw_bezier_outline( m_pstream, ft_face,
|
||||||
|
(FT_UInt)(glyphs->glyphs[glyph_idx].glyph),
|
||||||
|
pos_x / PANGO_SCALE,
|
||||||
|
pos_y / PANGO_SCALE,
|
||||||
|
1.0/(ps_kludge_factor * scale * 26.6),
|
||||||
|
1.0/(ps_kludge_factor * scale * 26.6) );
|
||||||
|
}
|
||||||
|
runs_list = runs_list->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_unref( G_OBJECT( layout ) );
|
||||||
|
g_object_unref( G_OBJECT( context ) );
|
||||||
|
#else
|
||||||
|
wxCoord text_w, text_h, text_descent;
|
||||||
|
|
||||||
|
GetTextExtent(text, &text_w, &text_h, &text_descent);
|
||||||
|
|
||||||
|
// VZ: this seems to be unnecessary, so taking it out for now, if it
|
||||||
|
// doesn't create any problems, remove this comment entirely
|
||||||
|
//SetFont( m_font );
|
||||||
|
|
||||||
int size = m_font.GetPointSize();
|
int size = m_font.GetPointSize();
|
||||||
|
|
||||||
// wxCoord by = y + (wxCoord)floor( double(size) * 2.0 / 3.0 ); // approximate baseline
|
// wxCoord by = y + (wxCoord)floor( double(size) * 2.0 / 3.0 ); // approximate baseline
|
||||||
@@ -1981,8 +1997,12 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_PANGO
|
#if wxUSE_PANGO
|
||||||
int dpi = GetResolution();
|
int wx_dpi = GetResolution();
|
||||||
PangoContext *context = pango_ft2_get_context ( dpi, dpi );
|
int pango_dpi = 600;
|
||||||
|
PangoContext *context = pango_ft2_get_context ( pango_dpi, pango_dpi );
|
||||||
|
|
||||||
|
double scale = pango_dpi / wx_dpi;
|
||||||
|
scale /= m_userScaleY;
|
||||||
|
|
||||||
pango_context_set_language (context, pango_language_from_string ("en_US"));
|
pango_context_set_language (context, pango_language_from_string ("en_US"));
|
||||||
pango_context_set_base_dir (context, PANGO_DIRECTION_LTR );
|
pango_context_set_base_dir (context, PANGO_DIRECTION_LTR );
|
||||||
@@ -1993,19 +2013,18 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
|
|||||||
pango_layout_set_font_description(layout, desc);
|
pango_layout_set_font_description(layout, desc);
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
|
const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
|
||||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
|
||||||
#else
|
#else
|
||||||
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
|
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
|
||||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
||||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
|
||||||
#endif
|
#endif
|
||||||
|
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
||||||
PangoLayoutLine *line = (PangoLayoutLine *)pango_layout_get_lines(layout)->data;
|
PangoLayoutLine *line = (PangoLayoutLine *)pango_layout_get_lines(layout)->data;
|
||||||
|
|
||||||
PangoRectangle rect;
|
PangoRectangle rect;
|
||||||
pango_layout_line_get_extents(line, NULL, &rect);
|
pango_layout_line_get_extents(line, NULL, &rect);
|
||||||
|
|
||||||
if (x) (*x) = (wxCoord) ( m_scaleX * rect.width / PANGO_SCALE );
|
if (x) (*x) = (wxCoord) ( rect.width / PANGO_SCALE / scale );
|
||||||
if (y) (*y) = (wxCoord) ( m_scaleY * rect.height / PANGO_SCALE );
|
if (y) (*y) = (wxCoord) ( rect.height / PANGO_SCALE / scale );
|
||||||
if (descent)
|
if (descent)
|
||||||
{
|
{
|
||||||
// Do something about metrics here
|
// Do something about metrics here
|
||||||
|
@@ -448,14 +448,11 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
ret.x = 0;
|
ret.x = 0;
|
||||||
if ( m_widget )
|
if ( m_widget )
|
||||||
{
|
{
|
||||||
GdkFont *font = m_font.GetInternalFont();
|
int width;
|
||||||
|
|
||||||
wxCoord width;
|
|
||||||
size_t count = GetCount();
|
size_t count = GetCount();
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
// FIXME GTK 2.0
|
GetTextExtent( GetString(n), &width, NULL, NULL, NULL, &m_font );
|
||||||
width = (wxCoord)gdk_string_width(font, wxGTK_CONV( GetString(n) ) );
|
|
||||||
if ( width > ret.x )
|
if ( width > ret.x )
|
||||||
ret.x = width;
|
ret.x = width;
|
||||||
}
|
}
|
||||||
@@ -477,7 +474,7 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
if ( ret.x < 80 )
|
if ( ret.x < 80 )
|
||||||
ret.x = 80;
|
ret.x = 80;
|
||||||
|
|
||||||
ret.y = 16 + gdk_char_height(GET_STYLE_FONT( m_widget->style ), 'H' );
|
ret.y = 16 + GetCharHeight();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -750,13 +750,11 @@ wxSize wxComboBox::DoGetBestSize() const
|
|||||||
ret.x = 0;
|
ret.x = 0;
|
||||||
if ( m_widget )
|
if ( m_widget )
|
||||||
{
|
{
|
||||||
GdkFont *font = m_font.GetInternalFont();
|
int width;
|
||||||
|
size_t count = GetCount();
|
||||||
wxCoord width;
|
|
||||||
size_t count = Number();
|
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
width = (wxCoord)gdk_string_width(font, wxGTK_CONV( GetString(n) ) );
|
GetTextExtent( GetString(n), &width, NULL, NULL, NULL, &m_font );
|
||||||
if ( width > ret.x )
|
if ( width > ret.x )
|
||||||
ret.x = width;
|
ret.x = width;
|
||||||
}
|
}
|
||||||
|
@@ -1436,27 +1436,56 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
#ifdef __WXGTK20__
|
#ifdef __WXGTK20__
|
||||||
// TODO: the layout engine should be abstracted at a higher level!
|
// TODO: the layout engine should be abstracted at a higher level!
|
||||||
PangoLayout *layout = pango_layout_new(m_context);
|
PangoLayout *layout = pango_layout_new(m_context);
|
||||||
pango_layout_set_font_description(layout, m_fontdesc);
|
|
||||||
{
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
|
const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
|
||||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
|
||||||
#else
|
#else
|
||||||
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
|
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
|
||||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
||||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
// Measure layout.
|
pango_layout_set_text( layout, (const char*)data, strlen((const char*)data) );
|
||||||
int w,h;
|
|
||||||
pango_layout_get_pixel_size(layout, &w, &h);
|
if (m_scaleY != 1.0)
|
||||||
wxCoord width = w;
|
{
|
||||||
wxCoord height = h;
|
// If there is a user or actually any scale applied to
|
||||||
|
// the device context, scale the font.
|
||||||
|
|
||||||
|
// scale font description
|
||||||
|
gint oldSize = pango_font_description_get_size( m_fontdesc );
|
||||||
|
double size = oldSize;
|
||||||
|
size = size * m_scaleY;
|
||||||
|
pango_font_description_set_size( m_fontdesc, (gint)size );
|
||||||
|
|
||||||
|
// actually apply scaled font
|
||||||
|
pango_layout_set_font_description( layout, m_fontdesc );
|
||||||
|
|
||||||
// Draw layout.
|
// Draw layout.
|
||||||
gdk_draw_layout( m_window, m_textGC, x, y, layout );
|
gdk_draw_layout( m_window, m_textGC, x, y, layout );
|
||||||
|
|
||||||
|
// reset unscaled size
|
||||||
|
pango_font_description_set_size( m_fontdesc, oldSize );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// actually apply font
|
||||||
|
pango_layout_set_font_description( layout, m_fontdesc );
|
||||||
|
|
||||||
|
// Draw layout.
|
||||||
|
gdk_draw_layout( m_window, m_textGC, x, y, layout );
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Measure layout
|
||||||
|
int w,h;
|
||||||
|
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||||
|
#else
|
||||||
|
int w = 10;
|
||||||
|
int h = 10;
|
||||||
|
#endif
|
||||||
|
wxCoord width = w;
|
||||||
|
wxCoord height = h;
|
||||||
|
|
||||||
g_object_unref( G_OBJECT( layout ) );
|
g_object_unref( G_OBJECT( layout ) );
|
||||||
#else // GTK+ 1.x
|
#else // GTK+ 1.x
|
||||||
wxCoord width = gdk_string_width( font, text.mbc_str() );
|
wxCoord width = gdk_string_width( font, text.mbc_str() );
|
||||||
@@ -1623,12 +1652,11 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
|||||||
// Set layout's text
|
// Set layout's text
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
|
const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
|
||||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
|
||||||
#else
|
#else
|
||||||
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
|
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
|
||||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
||||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
|
||||||
#endif
|
#endif
|
||||||
|
pango_layout_set_text( layout, (const char*) data, strlen((const char*)data) );
|
||||||
|
|
||||||
// Measure text.
|
// Measure text.
|
||||||
int w,h;
|
int w,h;
|
||||||
|
@@ -64,6 +64,8 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial
|
|||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
GtkFontSelectionDialog *fontdlg = GTK_FONT_SELECTION_DIALOG(dialog->m_widget);
|
GtkFontSelectionDialog *fontdlg = GTK_FONT_SELECTION_DIALOG(dialog->m_widget);
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
GdkFont *gfont = gtk_font_selection_dialog_get_font(fontdlg);
|
GdkFont *gfont = gtk_font_selection_dialog_get_font(fontdlg);
|
||||||
|
|
||||||
if (!gfont)
|
if (!gfont)
|
||||||
@@ -72,13 +74,10 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial
|
|||||||
wxOK | wxICON_ERROR);
|
wxOK | wxICON_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gchar *fontname = gtk_font_selection_dialog_get_font_name( fontdlg );
|
gchar *fontname = gtk_font_selection_dialog_get_font_name( fontdlg );
|
||||||
|
|
||||||
// printf( "font %s\n", fontname );
|
|
||||||
|
|
||||||
dialog->SetChosenFont( fontname);
|
dialog->SetChosenFont( fontname);
|
||||||
|
|
||||||
g_free( fontname );
|
g_free( fontname );
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
|
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
|
||||||
|
@@ -145,7 +145,7 @@ static wxString wxReplaceUnderscore( const wxString& title )
|
|||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if __WXGTK12__
|
#ifdef __WXGTK12__
|
||||||
if ( *pc == wxT('_') )
|
if ( *pc == wxT('_') )
|
||||||
{
|
{
|
||||||
// underscores must be doubled to prevent them from being
|
// underscores must be doubled to prevent them from being
|
||||||
@@ -907,7 +907,7 @@ void wxMenuItem::DoSetText( const wxString& str )
|
|||||||
#if GTK_CHECK_VERSION(2, 0, 0)
|
#if GTK_CHECK_VERSION(2, 0, 0)
|
||||||
else if ( *pc == wxT('_') ) // escape underscores
|
else if ( *pc == wxT('_') ) // escape underscores
|
||||||
{
|
{
|
||||||
// m_text << wxT("__"); doesn't work
|
m_text << wxT("__");
|
||||||
}
|
}
|
||||||
else if (*pc == wxT('/')) // we have to escape slashes
|
else if (*pc == wxT('/')) // we have to escape slashes
|
||||||
{
|
{
|
||||||
@@ -1010,8 +1010,12 @@ wxString wxMenuItem::GetFactoryPath() const
|
|||||||
{
|
{
|
||||||
if ( *pc == wxT('_') )
|
if ( *pc == wxT('_') )
|
||||||
{
|
{
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
pc++;
|
||||||
|
#else
|
||||||
// remove '_' unconditionally
|
// remove '_' unconditionally
|
||||||
continue;
|
continue;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't remove ampersands '&' since if we have them in the menu item title
|
// don't remove ampersands '&' since if we have them in the menu item title
|
||||||
|
@@ -82,28 +82,28 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
|
|||||||
0, 0,
|
0, 0,
|
||||||
win->m_width, win->m_height );
|
win->m_width, win->m_height );
|
||||||
|
|
||||||
if (!win->m_title.IsEmpty() &&
|
if (!win->GetTitle().IsEmpty() &&
|
||||||
((win->GetWindowStyle() & wxCAPTION) ||
|
((win->GetWindowStyle() & wxCAPTION) ||
|
||||||
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
||||||
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
||||||
{
|
{
|
||||||
GdkGC *gc = gdk_gc_new( pizza->bin_window );
|
wxClientDC dc(win);
|
||||||
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
dc.SetFont( *wxSMALL_FONT );
|
||||||
|
int height = dc.GetCharHeight();
|
||||||
|
|
||||||
|
GdkGC *gc = gdk_gc_new( pizza->bin_window );
|
||||||
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
||||||
gdk_draw_rectangle( pizza->bin_window, gc, TRUE,
|
gdk_draw_rectangle( pizza->bin_window, gc, TRUE,
|
||||||
3,
|
3,
|
||||||
3,
|
3,
|
||||||
win->m_width - 7,
|
win->m_width - 7,
|
||||||
font->ascent + font->descent+1 );
|
height+1 );
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->fg[GTK_STATE_SELECTED] );
|
|
||||||
gdk_draw_string( pizza->bin_window, font, gc,
|
|
||||||
6,
|
|
||||||
3+font->ascent,
|
|
||||||
wxGTK_CONV( win->m_title ) );
|
|
||||||
|
|
||||||
gdk_gc_unref( gc );
|
gdk_gc_unref( gc );
|
||||||
|
|
||||||
|
// Hack alert
|
||||||
|
dc.m_window = pizza->bin_window;
|
||||||
|
dc.SetTextForeground( *wxWHITE );
|
||||||
|
dc.DrawText( win->GetTitle(), 6, 3 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,6 +111,7 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
|
|||||||
// "draw" of m_mainWidget
|
// "draw" of m_mainWidget
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxFrame *win )
|
static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxFrame *win )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
@@ -131,25 +132,26 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
|
|||||||
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
||||||
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
||||||
{
|
{
|
||||||
GdkGC *gc = gdk_gc_new( pizza->bin_window );
|
wxClientDC dc(win);
|
||||||
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
dc.SetFont( *wxSMALL_FONT );
|
||||||
|
int height = dc.GetCharHeight();
|
||||||
|
|
||||||
|
GdkGC *gc = gdk_gc_new( pizza->bin_window );
|
||||||
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
||||||
gdk_draw_rectangle( pizza->bin_window, gc, TRUE,
|
gdk_draw_rectangle( pizza->bin_window, gc, TRUE,
|
||||||
3,
|
3,
|
||||||
3,
|
3,
|
||||||
win->m_width - 7,
|
win->m_width - 7,
|
||||||
font->ascent + font->descent+1 );
|
height+1 );
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->fg[GTK_STATE_SELECTED] );
|
|
||||||
gdk_draw_string( pizza->bin_window, font, gc,
|
|
||||||
6,
|
|
||||||
3+font->ascent,
|
|
||||||
wxGTK_CONV( win->m_title ) );
|
|
||||||
|
|
||||||
gdk_gc_unref( gc );
|
gdk_gc_unref( gc );
|
||||||
|
|
||||||
|
// Hack alert
|
||||||
|
dc.m_window = pizza->bin_window;
|
||||||
|
dc.SetTextForeground( *wxWHITE );
|
||||||
|
dc.DrawText( win->GetTitle(), 6, 3 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "button_press_event" of m_mainWidget
|
// "button_press_event" of m_mainWidget
|
||||||
@@ -168,8 +170,10 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
GtkPizza *pizza = GTK_PIZZA(widget);
|
GtkPizza *pizza = GTK_PIZZA(widget);
|
||||||
if (gdk_event->window != pizza->bin_window) return TRUE;
|
if (gdk_event->window != pizza->bin_window) return TRUE;
|
||||||
|
|
||||||
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
wxClientDC dc(win);
|
||||||
int height = font->ascent + font->descent+1;
|
dc.SetFont( *wxSMALL_FONT );
|
||||||
|
int height = dc.GetCharHeight() + 1;
|
||||||
|
|
||||||
if (gdk_event->y > height) return TRUE;
|
if (gdk_event->y > height) return TRUE;
|
||||||
|
|
||||||
gdk_window_raise( win->m_widget->window );
|
gdk_window_raise( win->m_widget->window );
|
||||||
@@ -364,8 +368,10 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event",
|
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event",
|
||||||
GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "draw",
|
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "draw",
|
||||||
GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this );
|
||||||
|
#endif
|
||||||
|
|
||||||
/* these are required for dragging the mini frame around */
|
/* these are required for dragging the mini frame around */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "button_press_event",
|
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "button_press_event",
|
||||||
|
@@ -328,21 +328,8 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
|
|||||||
if (!g_systemFont)
|
if (!g_systemFont)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK20__
|
#ifdef __WXGTK20__
|
||||||
GtkWidget *widget = gtk_button_new();
|
const gchar *font_name = _gtk_rc_context_get_default_font_name (gtk_settings_get_default ());
|
||||||
GtkStyle *def = gtk_rc_get_style( widget );
|
g_systemFont = new wxFont( wxString::FromAscii( font_name ) );
|
||||||
if (!def)
|
|
||||||
def = gtk_widget_get_default_style();
|
|
||||||
if (def)
|
|
||||||
{
|
|
||||||
wxNativeFontInfo info;
|
|
||||||
info.description = def->font_desc;
|
|
||||||
g_systemFont = new wxFont(info);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
|
|
||||||
}
|
|
||||||
gtk_widget_destroy( widget );
|
|
||||||
#else
|
#else
|
||||||
g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
|
g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
|
||||||
#endif
|
#endif
|
||||||
|
@@ -343,8 +343,6 @@ bool wxToolBar::Create( wxWindow *parent,
|
|||||||
|
|
||||||
g_style->bg[GTK_STATE_NORMAL] = *m_bg;
|
g_style->bg[GTK_STATE_NORMAL] = *m_bg;
|
||||||
|
|
||||||
SET_STYLE_FONT(g_style, GtkGetDefaultGuiFont());
|
|
||||||
|
|
||||||
gtk_widget_set_style( GTK_TOOLBAR(m_toolbar)->tooltips->tip_window, g_style );
|
gtk_widget_set_style( GTK_TOOLBAR(m_toolbar)->tooltips->tip_window, g_style );
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
@@ -76,8 +76,6 @@ void wxToolTip::Apply( wxWindow *win )
|
|||||||
g_style->fg[GTK_STATE_NORMAL] = ss_fg;
|
g_style->fg[GTK_STATE_NORMAL] = ss_fg;
|
||||||
g_style->bg[GTK_STATE_NORMAL] = ss_bg;
|
g_style->bg[GTK_STATE_NORMAL] = ss_bg;
|
||||||
|
|
||||||
SET_STYLE_FONT( g_style, GtkGetDefaultGuiFont() );
|
|
||||||
|
|
||||||
gtk_widget_set_style( ss_tooltips->tip_window, g_style );
|
gtk_widget_set_style( ss_tooltips->tip_window, g_style );
|
||||||
#else // GTK+ 1.0
|
#else // GTK+ 1.0
|
||||||
gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg );
|
gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg );
|
||||||
|
@@ -1695,6 +1695,20 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
|
|||||||
wxPrintf( wxT(".\n") );
|
wxPrintf( wxT(".\n") );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
|
if (event_type == wxEVT_LEFT_DCLICK)
|
||||||
|
{
|
||||||
|
// GTK 1.2 crashes when intercepting double
|
||||||
|
// click events from both wxSpinButton and
|
||||||
|
// wxSpinCtrl
|
||||||
|
if (GTK_IS_SPIN_BUTTON(win->m_widget))
|
||||||
|
{
|
||||||
|
// Just disable this event for now.
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||||
{
|
{
|
||||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
|
||||||
@@ -3406,9 +3420,31 @@ int wxWindowGTK::GetCharHeight() const
|
|||||||
|
|
||||||
wxCHECK_MSG( m_font.Ok(), 12, wxT("invalid font") );
|
wxCHECK_MSG( m_font.Ok(), 12, wxT("invalid font") );
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
PangoContext *context = NULL;
|
||||||
|
if (m_widget)
|
||||||
|
context = gtk_widget_get_pango_context( m_widget );
|
||||||
|
|
||||||
|
if (!context)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
PangoFontDescription *desc = m_font.GetNativeFontInfo()->description;
|
||||||
|
PangoLayout *layout = pango_layout_new(context);
|
||||||
|
pango_layout_set_font_description(layout, desc);
|
||||||
|
pango_layout_set_text(layout, "H", 1);
|
||||||
|
PangoLayoutLine *line = (PangoLayoutLine *)pango_layout_get_lines(layout)->data;
|
||||||
|
|
||||||
|
PangoRectangle rect;
|
||||||
|
pango_layout_line_get_extents(line, NULL, &rect);
|
||||||
|
|
||||||
|
g_object_unref( G_OBJECT( layout ) );
|
||||||
|
|
||||||
|
return (int) (rect.height / PANGO_SCALE);
|
||||||
|
#else
|
||||||
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
||||||
|
|
||||||
return font->ascent + font->descent;
|
return font->ascent + font->descent;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxWindowGTK::GetCharWidth() const
|
int wxWindowGTK::GetCharWidth() const
|
||||||
@@ -3417,9 +3453,31 @@ int wxWindowGTK::GetCharWidth() const
|
|||||||
|
|
||||||
wxCHECK_MSG( m_font.Ok(), 8, wxT("invalid font") );
|
wxCHECK_MSG( m_font.Ok(), 8, wxT("invalid font") );
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
PangoContext *context = NULL;
|
||||||
|
if (m_widget)
|
||||||
|
context = gtk_widget_get_pango_context( m_widget );
|
||||||
|
|
||||||
|
if (!context)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
PangoFontDescription *desc = m_font.GetNativeFontInfo()->description;
|
||||||
|
PangoLayout *layout = pango_layout_new(context);
|
||||||
|
pango_layout_set_font_description(layout, desc);
|
||||||
|
pango_layout_set_text(layout, "H", 1);
|
||||||
|
PangoLayoutLine *line = (PangoLayoutLine *)pango_layout_get_lines(layout)->data;
|
||||||
|
|
||||||
|
PangoRectangle rect;
|
||||||
|
pango_layout_line_get_extents(line, NULL, &rect);
|
||||||
|
|
||||||
|
g_object_unref( G_OBJECT( layout ) );
|
||||||
|
|
||||||
|
return (int) (rect.width / PANGO_SCALE);
|
||||||
|
#else
|
||||||
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
||||||
|
|
||||||
return gdk_string_width( font, "H" );
|
return gdk_string_width( font, "H" );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowGTK::GetTextExtent( const wxString& string,
|
void wxWindowGTK::GetTextExtent( const wxString& string,
|
||||||
@@ -4089,7 +4147,13 @@ void wxWindowGTK::SetWidgetStyle()
|
|||||||
|
|
||||||
if (m_font != wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ))
|
if (m_font != wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ))
|
||||||
{
|
{
|
||||||
SET_STYLE_FONT(style, m_font.GetInternalFont( 1.0 ));
|
#ifdef __WXGTK20__
|
||||||
|
pango_font_description_free( style->font_desc );
|
||||||
|
pango_font_description_copy( m_font.GetNativeFontInfo()->description );
|
||||||
|
#else
|
||||||
|
gdk_font_unref( style->font );
|
||||||
|
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_foregroundColour.Ok())
|
if (m_foregroundColour.Ok())
|
||||||
|
@@ -448,14 +448,11 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
ret.x = 0;
|
ret.x = 0;
|
||||||
if ( m_widget )
|
if ( m_widget )
|
||||||
{
|
{
|
||||||
GdkFont *font = m_font.GetInternalFont();
|
int width;
|
||||||
|
|
||||||
wxCoord width;
|
|
||||||
size_t count = GetCount();
|
size_t count = GetCount();
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
// FIXME GTK 2.0
|
GetTextExtent( GetString(n), &width, NULL, NULL, NULL, &m_font );
|
||||||
width = (wxCoord)gdk_string_width(font, wxGTK_CONV( GetString(n) ) );
|
|
||||||
if ( width > ret.x )
|
if ( width > ret.x )
|
||||||
ret.x = width;
|
ret.x = width;
|
||||||
}
|
}
|
||||||
@@ -477,7 +474,7 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
if ( ret.x < 80 )
|
if ( ret.x < 80 )
|
||||||
ret.x = 80;
|
ret.x = 80;
|
||||||
|
|
||||||
ret.y = 16 + gdk_char_height(GET_STYLE_FONT( m_widget->style ), 'H' );
|
ret.y = 16 + GetCharHeight();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -750,13 +750,11 @@ wxSize wxComboBox::DoGetBestSize() const
|
|||||||
ret.x = 0;
|
ret.x = 0;
|
||||||
if ( m_widget )
|
if ( m_widget )
|
||||||
{
|
{
|
||||||
GdkFont *font = m_font.GetInternalFont();
|
int width;
|
||||||
|
size_t count = GetCount();
|
||||||
wxCoord width;
|
|
||||||
size_t count = Number();
|
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
width = (wxCoord)gdk_string_width(font, wxGTK_CONV( GetString(n) ) );
|
GetTextExtent( GetString(n), &width, NULL, NULL, NULL, &m_font );
|
||||||
if ( width > ret.x )
|
if ( width > ret.x )
|
||||||
ret.x = width;
|
ret.x = width;
|
||||||
}
|
}
|
||||||
|
@@ -1436,27 +1436,56 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
#ifdef __WXGTK20__
|
#ifdef __WXGTK20__
|
||||||
// TODO: the layout engine should be abstracted at a higher level!
|
// TODO: the layout engine should be abstracted at a higher level!
|
||||||
PangoLayout *layout = pango_layout_new(m_context);
|
PangoLayout *layout = pango_layout_new(m_context);
|
||||||
pango_layout_set_font_description(layout, m_fontdesc);
|
|
||||||
{
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
|
const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
|
||||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
|
||||||
#else
|
#else
|
||||||
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
|
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
|
||||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
||||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
// Measure layout.
|
pango_layout_set_text( layout, (const char*)data, strlen((const char*)data) );
|
||||||
int w,h;
|
|
||||||
pango_layout_get_pixel_size(layout, &w, &h);
|
if (m_scaleY != 1.0)
|
||||||
wxCoord width = w;
|
{
|
||||||
wxCoord height = h;
|
// If there is a user or actually any scale applied to
|
||||||
|
// the device context, scale the font.
|
||||||
|
|
||||||
|
// scale font description
|
||||||
|
gint oldSize = pango_font_description_get_size( m_fontdesc );
|
||||||
|
double size = oldSize;
|
||||||
|
size = size * m_scaleY;
|
||||||
|
pango_font_description_set_size( m_fontdesc, (gint)size );
|
||||||
|
|
||||||
|
// actually apply scaled font
|
||||||
|
pango_layout_set_font_description( layout, m_fontdesc );
|
||||||
|
|
||||||
// Draw layout.
|
// Draw layout.
|
||||||
gdk_draw_layout( m_window, m_textGC, x, y, layout );
|
gdk_draw_layout( m_window, m_textGC, x, y, layout );
|
||||||
|
|
||||||
|
// reset unscaled size
|
||||||
|
pango_font_description_set_size( m_fontdesc, oldSize );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// actually apply font
|
||||||
|
pango_layout_set_font_description( layout, m_fontdesc );
|
||||||
|
|
||||||
|
// Draw layout.
|
||||||
|
gdk_draw_layout( m_window, m_textGC, x, y, layout );
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Measure layout
|
||||||
|
int w,h;
|
||||||
|
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||||
|
#else
|
||||||
|
int w = 10;
|
||||||
|
int h = 10;
|
||||||
|
#endif
|
||||||
|
wxCoord width = w;
|
||||||
|
wxCoord height = h;
|
||||||
|
|
||||||
g_object_unref( G_OBJECT( layout ) );
|
g_object_unref( G_OBJECT( layout ) );
|
||||||
#else // GTK+ 1.x
|
#else // GTK+ 1.x
|
||||||
wxCoord width = gdk_string_width( font, text.mbc_str() );
|
wxCoord width = gdk_string_width( font, text.mbc_str() );
|
||||||
@@ -1623,12 +1652,11 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
|||||||
// Set layout's text
|
// Set layout's text
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
|
const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
|
||||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
|
||||||
#else
|
#else
|
||||||
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
|
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
|
||||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
|
||||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
|
||||||
#endif
|
#endif
|
||||||
|
pango_layout_set_text( layout, (const char*) data, strlen((const char*)data) );
|
||||||
|
|
||||||
// Measure text.
|
// Measure text.
|
||||||
int w,h;
|
int w,h;
|
||||||
|
@@ -64,6 +64,8 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial
|
|||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
GtkFontSelectionDialog *fontdlg = GTK_FONT_SELECTION_DIALOG(dialog->m_widget);
|
GtkFontSelectionDialog *fontdlg = GTK_FONT_SELECTION_DIALOG(dialog->m_widget);
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
GdkFont *gfont = gtk_font_selection_dialog_get_font(fontdlg);
|
GdkFont *gfont = gtk_font_selection_dialog_get_font(fontdlg);
|
||||||
|
|
||||||
if (!gfont)
|
if (!gfont)
|
||||||
@@ -72,13 +74,10 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial
|
|||||||
wxOK | wxICON_ERROR);
|
wxOK | wxICON_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gchar *fontname = gtk_font_selection_dialog_get_font_name( fontdlg );
|
gchar *fontname = gtk_font_selection_dialog_get_font_name( fontdlg );
|
||||||
|
|
||||||
// printf( "font %s\n", fontname );
|
|
||||||
|
|
||||||
dialog->SetChosenFont( fontname);
|
dialog->SetChosenFont( fontname);
|
||||||
|
|
||||||
g_free( fontname );
|
g_free( fontname );
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
|
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
|
||||||
|
@@ -145,7 +145,7 @@ static wxString wxReplaceUnderscore( const wxString& title )
|
|||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if __WXGTK12__
|
#ifdef __WXGTK12__
|
||||||
if ( *pc == wxT('_') )
|
if ( *pc == wxT('_') )
|
||||||
{
|
{
|
||||||
// underscores must be doubled to prevent them from being
|
// underscores must be doubled to prevent them from being
|
||||||
@@ -907,7 +907,7 @@ void wxMenuItem::DoSetText( const wxString& str )
|
|||||||
#if GTK_CHECK_VERSION(2, 0, 0)
|
#if GTK_CHECK_VERSION(2, 0, 0)
|
||||||
else if ( *pc == wxT('_') ) // escape underscores
|
else if ( *pc == wxT('_') ) // escape underscores
|
||||||
{
|
{
|
||||||
// m_text << wxT("__"); doesn't work
|
m_text << wxT("__");
|
||||||
}
|
}
|
||||||
else if (*pc == wxT('/')) // we have to escape slashes
|
else if (*pc == wxT('/')) // we have to escape slashes
|
||||||
{
|
{
|
||||||
@@ -1010,8 +1010,12 @@ wxString wxMenuItem::GetFactoryPath() const
|
|||||||
{
|
{
|
||||||
if ( *pc == wxT('_') )
|
if ( *pc == wxT('_') )
|
||||||
{
|
{
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
pc++;
|
||||||
|
#else
|
||||||
// remove '_' unconditionally
|
// remove '_' unconditionally
|
||||||
continue;
|
continue;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't remove ampersands '&' since if we have them in the menu item title
|
// don't remove ampersands '&' since if we have them in the menu item title
|
||||||
|
@@ -82,28 +82,28 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
|
|||||||
0, 0,
|
0, 0,
|
||||||
win->m_width, win->m_height );
|
win->m_width, win->m_height );
|
||||||
|
|
||||||
if (!win->m_title.IsEmpty() &&
|
if (!win->GetTitle().IsEmpty() &&
|
||||||
((win->GetWindowStyle() & wxCAPTION) ||
|
((win->GetWindowStyle() & wxCAPTION) ||
|
||||||
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
||||||
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
||||||
{
|
{
|
||||||
GdkGC *gc = gdk_gc_new( pizza->bin_window );
|
wxClientDC dc(win);
|
||||||
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
dc.SetFont( *wxSMALL_FONT );
|
||||||
|
int height = dc.GetCharHeight();
|
||||||
|
|
||||||
|
GdkGC *gc = gdk_gc_new( pizza->bin_window );
|
||||||
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
||||||
gdk_draw_rectangle( pizza->bin_window, gc, TRUE,
|
gdk_draw_rectangle( pizza->bin_window, gc, TRUE,
|
||||||
3,
|
3,
|
||||||
3,
|
3,
|
||||||
win->m_width - 7,
|
win->m_width - 7,
|
||||||
font->ascent + font->descent+1 );
|
height+1 );
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->fg[GTK_STATE_SELECTED] );
|
|
||||||
gdk_draw_string( pizza->bin_window, font, gc,
|
|
||||||
6,
|
|
||||||
3+font->ascent,
|
|
||||||
wxGTK_CONV( win->m_title ) );
|
|
||||||
|
|
||||||
gdk_gc_unref( gc );
|
gdk_gc_unref( gc );
|
||||||
|
|
||||||
|
// Hack alert
|
||||||
|
dc.m_window = pizza->bin_window;
|
||||||
|
dc.SetTextForeground( *wxWHITE );
|
||||||
|
dc.DrawText( win->GetTitle(), 6, 3 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,6 +111,7 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
|
|||||||
// "draw" of m_mainWidget
|
// "draw" of m_mainWidget
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxFrame *win )
|
static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxFrame *win )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
@@ -131,25 +132,26 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
|
|||||||
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
||||||
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
||||||
{
|
{
|
||||||
GdkGC *gc = gdk_gc_new( pizza->bin_window );
|
wxClientDC dc(win);
|
||||||
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
dc.SetFont( *wxSMALL_FONT );
|
||||||
|
int height = dc.GetCharHeight();
|
||||||
|
|
||||||
|
GdkGC *gc = gdk_gc_new( pizza->bin_window );
|
||||||
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
||||||
gdk_draw_rectangle( pizza->bin_window, gc, TRUE,
|
gdk_draw_rectangle( pizza->bin_window, gc, TRUE,
|
||||||
3,
|
3,
|
||||||
3,
|
3,
|
||||||
win->m_width - 7,
|
win->m_width - 7,
|
||||||
font->ascent + font->descent+1 );
|
height+1 );
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->fg[GTK_STATE_SELECTED] );
|
|
||||||
gdk_draw_string( pizza->bin_window, font, gc,
|
|
||||||
6,
|
|
||||||
3+font->ascent,
|
|
||||||
wxGTK_CONV( win->m_title ) );
|
|
||||||
|
|
||||||
gdk_gc_unref( gc );
|
gdk_gc_unref( gc );
|
||||||
|
|
||||||
|
// Hack alert
|
||||||
|
dc.m_window = pizza->bin_window;
|
||||||
|
dc.SetTextForeground( *wxWHITE );
|
||||||
|
dc.DrawText( win->GetTitle(), 6, 3 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "button_press_event" of m_mainWidget
|
// "button_press_event" of m_mainWidget
|
||||||
@@ -168,8 +170,10 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
GtkPizza *pizza = GTK_PIZZA(widget);
|
GtkPizza *pizza = GTK_PIZZA(widget);
|
||||||
if (gdk_event->window != pizza->bin_window) return TRUE;
|
if (gdk_event->window != pizza->bin_window) return TRUE;
|
||||||
|
|
||||||
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
wxClientDC dc(win);
|
||||||
int height = font->ascent + font->descent+1;
|
dc.SetFont( *wxSMALL_FONT );
|
||||||
|
int height = dc.GetCharHeight() + 1;
|
||||||
|
|
||||||
if (gdk_event->y > height) return TRUE;
|
if (gdk_event->y > height) return TRUE;
|
||||||
|
|
||||||
gdk_window_raise( win->m_widget->window );
|
gdk_window_raise( win->m_widget->window );
|
||||||
@@ -364,8 +368,10 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event",
|
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event",
|
||||||
GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "draw",
|
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "draw",
|
||||||
GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this );
|
||||||
|
#endif
|
||||||
|
|
||||||
/* these are required for dragging the mini frame around */
|
/* these are required for dragging the mini frame around */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "button_press_event",
|
gtk_signal_connect( GTK_OBJECT(m_mainWidget), "button_press_event",
|
||||||
|
@@ -328,21 +328,8 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
|
|||||||
if (!g_systemFont)
|
if (!g_systemFont)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK20__
|
#ifdef __WXGTK20__
|
||||||
GtkWidget *widget = gtk_button_new();
|
const gchar *font_name = _gtk_rc_context_get_default_font_name (gtk_settings_get_default ());
|
||||||
GtkStyle *def = gtk_rc_get_style( widget );
|
g_systemFont = new wxFont( wxString::FromAscii( font_name ) );
|
||||||
if (!def)
|
|
||||||
def = gtk_widget_get_default_style();
|
|
||||||
if (def)
|
|
||||||
{
|
|
||||||
wxNativeFontInfo info;
|
|
||||||
info.description = def->font_desc;
|
|
||||||
g_systemFont = new wxFont(info);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
|
|
||||||
}
|
|
||||||
gtk_widget_destroy( widget );
|
|
||||||
#else
|
#else
|
||||||
g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
|
g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
|
||||||
#endif
|
#endif
|
||||||
|
@@ -343,8 +343,6 @@ bool wxToolBar::Create( wxWindow *parent,
|
|||||||
|
|
||||||
g_style->bg[GTK_STATE_NORMAL] = *m_bg;
|
g_style->bg[GTK_STATE_NORMAL] = *m_bg;
|
||||||
|
|
||||||
SET_STYLE_FONT(g_style, GtkGetDefaultGuiFont());
|
|
||||||
|
|
||||||
gtk_widget_set_style( GTK_TOOLBAR(m_toolbar)->tooltips->tip_window, g_style );
|
gtk_widget_set_style( GTK_TOOLBAR(m_toolbar)->tooltips->tip_window, g_style );
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
@@ -76,8 +76,6 @@ void wxToolTip::Apply( wxWindow *win )
|
|||||||
g_style->fg[GTK_STATE_NORMAL] = ss_fg;
|
g_style->fg[GTK_STATE_NORMAL] = ss_fg;
|
||||||
g_style->bg[GTK_STATE_NORMAL] = ss_bg;
|
g_style->bg[GTK_STATE_NORMAL] = ss_bg;
|
||||||
|
|
||||||
SET_STYLE_FONT( g_style, GtkGetDefaultGuiFont() );
|
|
||||||
|
|
||||||
gtk_widget_set_style( ss_tooltips->tip_window, g_style );
|
gtk_widget_set_style( ss_tooltips->tip_window, g_style );
|
||||||
#else // GTK+ 1.0
|
#else // GTK+ 1.0
|
||||||
gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg );
|
gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg );
|
||||||
|
@@ -1695,6 +1695,20 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
|
|||||||
wxPrintf( wxT(".\n") );
|
wxPrintf( wxT(".\n") );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
|
if (event_type == wxEVT_LEFT_DCLICK)
|
||||||
|
{
|
||||||
|
// GTK 1.2 crashes when intercepting double
|
||||||
|
// click events from both wxSpinButton and
|
||||||
|
// wxSpinCtrl
|
||||||
|
if (GTK_IS_SPIN_BUTTON(win->m_widget))
|
||||||
|
{
|
||||||
|
// Just disable this event for now.
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||||
{
|
{
|
||||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
|
||||||
@@ -3406,9 +3420,31 @@ int wxWindowGTK::GetCharHeight() const
|
|||||||
|
|
||||||
wxCHECK_MSG( m_font.Ok(), 12, wxT("invalid font") );
|
wxCHECK_MSG( m_font.Ok(), 12, wxT("invalid font") );
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
PangoContext *context = NULL;
|
||||||
|
if (m_widget)
|
||||||
|
context = gtk_widget_get_pango_context( m_widget );
|
||||||
|
|
||||||
|
if (!context)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
PangoFontDescription *desc = m_font.GetNativeFontInfo()->description;
|
||||||
|
PangoLayout *layout = pango_layout_new(context);
|
||||||
|
pango_layout_set_font_description(layout, desc);
|
||||||
|
pango_layout_set_text(layout, "H", 1);
|
||||||
|
PangoLayoutLine *line = (PangoLayoutLine *)pango_layout_get_lines(layout)->data;
|
||||||
|
|
||||||
|
PangoRectangle rect;
|
||||||
|
pango_layout_line_get_extents(line, NULL, &rect);
|
||||||
|
|
||||||
|
g_object_unref( G_OBJECT( layout ) );
|
||||||
|
|
||||||
|
return (int) (rect.height / PANGO_SCALE);
|
||||||
|
#else
|
||||||
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
||||||
|
|
||||||
return font->ascent + font->descent;
|
return font->ascent + font->descent;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxWindowGTK::GetCharWidth() const
|
int wxWindowGTK::GetCharWidth() const
|
||||||
@@ -3417,9 +3453,31 @@ int wxWindowGTK::GetCharWidth() const
|
|||||||
|
|
||||||
wxCHECK_MSG( m_font.Ok(), 8, wxT("invalid font") );
|
wxCHECK_MSG( m_font.Ok(), 8, wxT("invalid font") );
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
PangoContext *context = NULL;
|
||||||
|
if (m_widget)
|
||||||
|
context = gtk_widget_get_pango_context( m_widget );
|
||||||
|
|
||||||
|
if (!context)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
PangoFontDescription *desc = m_font.GetNativeFontInfo()->description;
|
||||||
|
PangoLayout *layout = pango_layout_new(context);
|
||||||
|
pango_layout_set_font_description(layout, desc);
|
||||||
|
pango_layout_set_text(layout, "H", 1);
|
||||||
|
PangoLayoutLine *line = (PangoLayoutLine *)pango_layout_get_lines(layout)->data;
|
||||||
|
|
||||||
|
PangoRectangle rect;
|
||||||
|
pango_layout_line_get_extents(line, NULL, &rect);
|
||||||
|
|
||||||
|
g_object_unref( G_OBJECT( layout ) );
|
||||||
|
|
||||||
|
return (int) (rect.width / PANGO_SCALE);
|
||||||
|
#else
|
||||||
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
||||||
|
|
||||||
return gdk_string_width( font, "H" );
|
return gdk_string_width( font, "H" );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowGTK::GetTextExtent( const wxString& string,
|
void wxWindowGTK::GetTextExtent( const wxString& string,
|
||||||
@@ -4089,7 +4147,13 @@ void wxWindowGTK::SetWidgetStyle()
|
|||||||
|
|
||||||
if (m_font != wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ))
|
if (m_font != wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ))
|
||||||
{
|
{
|
||||||
SET_STYLE_FONT(style, m_font.GetInternalFont( 1.0 ));
|
#ifdef __WXGTK20__
|
||||||
|
pango_font_description_free( style->font_desc );
|
||||||
|
pango_font_description_copy( m_font.GetNativeFontInfo()->description );
|
||||||
|
#else
|
||||||
|
gdk_font_unref( style->font );
|
||||||
|
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_foregroundColour.Ok())
|
if (m_foregroundColour.Ok())
|
||||||
|
@@ -132,26 +132,30 @@ wxFontEncoding wxNativeFontInfo::GetEncoding() const
|
|||||||
return wxFONTENCODING_SYSTEM;
|
return wxFONTENCODING_SYSTEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxNativeFontInfo::FromString(const wxString& s)
|
bool wxNativeFontInfo::FromString( const wxString& str )
|
||||||
{
|
{
|
||||||
if (description)
|
if (description)
|
||||||
pango_font_description_free( description );
|
pango_font_description_free( description );
|
||||||
|
|
||||||
description = pango_font_description_from_string( wxGTK_CONV( s ) );
|
description = pango_font_description_from_string( wxGTK_CONV( str ) );
|
||||||
|
|
||||||
|
// wxPrintf( L"FromString result: %s\n", ToString().c_str() );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxNativeFontInfo::ToString() const
|
wxString wxNativeFontInfo::ToString() const
|
||||||
{
|
{
|
||||||
wxString tmp = wxGTK_CONV_BACK( pango_font_description_to_string( description ) );
|
char *str = pango_font_description_to_string( description );
|
||||||
|
wxString tmp = wxGTK_CONV_BACK( str );
|
||||||
|
g_free( str );
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxNativeFontInfo::FromUserString(const wxString& s)
|
bool wxNativeFontInfo::FromUserString( const wxString& str )
|
||||||
{
|
{
|
||||||
return FromString( s );
|
return FromString( str );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxNativeFontInfo::ToUserString() const
|
wxString wxNativeFontInfo::ToUserString() const
|
||||||
|
Reference in New Issue
Block a user