From d332c5145608d5ba89d75b60be6ed3aa7f60846a Mon Sep 17 00:00:00 2001 From: Mart Raudsepp Date: Wed, 24 Aug 2005 00:25:19 +0000 Subject: [PATCH 1/1] [wxGTK2] Don't duplicate code inside wxFontRefData::InitFromNative() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35294 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/font.cpp | 34 ++++------------------------------ src/gtk1/font.cpp | 34 ++++------------------------------ 2 files changed, 8 insertions(+), 60 deletions(-) diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 9e42fdf9e6..4bc698751a 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -239,37 +239,11 @@ void wxFontRefData::InitFromNative() // Pango sometimes needs to have a size int pango_size = pango_font_description_get_size( desc ); if (pango_size == 0) - pango_font_description_set_size( desc, 12 * PANGO_SCALE); + m_nativeFontInfo.SetPointSize(12); - m_pointSize = pango_font_description_get_size( desc ) / PANGO_SCALE; - - switch (pango_font_description_get_style( desc )) - { - case PANGO_STYLE_NORMAL: - m_style = wxFONTSTYLE_NORMAL; - break; - case PANGO_STYLE_ITALIC: - m_style = wxFONTSTYLE_ITALIC; - break; - case PANGO_STYLE_OBLIQUE: - m_style = wxFONTSTYLE_SLANT; - break; - } - - PangoWeight pango_weight = pango_font_description_get_weight( desc ); - - if (pango_weight >= 600) - { - m_weight = wxFONTWEIGHT_BOLD; - } - else if (pango_weight < 350) - { - m_weight = wxFONTWEIGHT_LIGHT; - } - else - { - m_weight = wxFONTWEIGHT_NORMAL; - } + m_pointSize = m_nativeFontInfo.GetPointSize(); + m_style = m_nativeFontInfo.GetStyle(); + m_weight = m_nativeFontInfo.GetWeight(); if (m_faceName == wxT("monospace")) { diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 9e42fdf9e6..4bc698751a 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -239,37 +239,11 @@ void wxFontRefData::InitFromNative() // Pango sometimes needs to have a size int pango_size = pango_font_description_get_size( desc ); if (pango_size == 0) - pango_font_description_set_size( desc, 12 * PANGO_SCALE); + m_nativeFontInfo.SetPointSize(12); - m_pointSize = pango_font_description_get_size( desc ) / PANGO_SCALE; - - switch (pango_font_description_get_style( desc )) - { - case PANGO_STYLE_NORMAL: - m_style = wxFONTSTYLE_NORMAL; - break; - case PANGO_STYLE_ITALIC: - m_style = wxFONTSTYLE_ITALIC; - break; - case PANGO_STYLE_OBLIQUE: - m_style = wxFONTSTYLE_SLANT; - break; - } - - PangoWeight pango_weight = pango_font_description_get_weight( desc ); - - if (pango_weight >= 600) - { - m_weight = wxFONTWEIGHT_BOLD; - } - else if (pango_weight < 350) - { - m_weight = wxFONTWEIGHT_LIGHT; - } - else - { - m_weight = wxFONTWEIGHT_NORMAL; - } + m_pointSize = m_nativeFontInfo.GetPointSize(); + m_style = m_nativeFontInfo.GetStyle(); + m_weight = m_nativeFontInfo.GetWeight(); if (m_faceName == wxT("monospace")) { -- 2.45.2