cui/source/tabpages/chardlg.cxx | 9 --------- cui/uiconfig/ui/charnamepage.ui | 9 +++++++++ vcl/source/window/builder.cxx | 9 +++++++++ vcl/source/window/window2.cxx | 7 +++++++ 4 files changed, 25 insertions(+), 9 deletions(-)
New commits: commit 6f17d42f251bf4a20b4192c16fa007226dcf17ed Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Jun 8 11:17:55 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Jun 8 14:22:36 2022 +0200 tdf#119827 implement GtkBuilder "scale" property for font size and use it for the case in charnamepage Change-Id: I5920aa429c750e9b147cbc09a6f3814166851a8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135493 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 638643601980..226fe846ee3d 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -258,15 +258,6 @@ SvxCharNamePage::SvxCharNamePage(weld::Container* pPage, weld::DialogController* else if (!bShowCTL) m_xCJK_CTL->remove_page("nbCTL"); - // info at 80% font size - vcl::Font aFont(m_xWestFontTypeFT->get_font()); - Size aSize(aFont.GetFontSize()); - aSize.setHeight(aSize.Height() * 0.8); - aFont.SetFontSize(aSize); - m_xWestFontTypeFT->set_font(aFont); - m_xEastFontTypeFT->set_font(aFont); - m_xCTLFontTypeFT->set_font(aFont); - //In MacOSX the standard dialogs name font-name, font-style as //Family, Typeface //In GNOME the standard dialogs name font-name, font-style as diff --git a/cui/uiconfig/ui/charnamepage.ui b/cui/uiconfig/ui/charnamepage.ui index c4d3501e696e..54d700ecb094 100644 --- a/cui/uiconfig/ui/charnamepage.ui +++ b/cui/uiconfig/ui/charnamepage.ui @@ -309,6 +309,9 @@ <property name="width-chars">30</property> <property name="max-width-chars">30</property> <property name="xalign">0</property> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> </object> <packing> <property name="left-attach">1</property> @@ -582,6 +585,9 @@ <property name="width-chars">30</property> <property name="max-width-chars">30</property> <property name="xalign">0</property> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> </object> <packing> <property name="left-attach">1</property> @@ -830,6 +836,9 @@ <property name="width-chars">30</property> <property name="max-width-chars">30</property> <property name="xalign">0</property> + <attributes> + <attribute name="scale" value="0.8"/> + </attributes> </object> <packing> <property name="left-attach">1</property> diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index c74d2038192a..d25426cedbe7 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2491,6 +2491,15 @@ VclPtr<vcl::Window> VclBuilder::insertObject(vcl::Window *pParent, const OString else BuilderUtils::set_properties(pCurrentChild, rProps); + // tdf#119827 handle size before scale so we can trivially + // scale on the current font size whether size is present + // or not. + VclBuilder::stringmap::iterator aSize = rPango.find(OString("size")); + if (aSize != rPango.end()) + { + pCurrentChild->set_font_attribute(aSize->first, aSize->second); + rPango.erase(aSize); + } for (auto const& elem : rPango) { const OString &rKey = elem.first; diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index eaa3c4fa7d25..c20dc471120b 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1450,6 +1450,13 @@ bool Window::set_font_attribute(const OString &rKey, std::u16string_view rValue) aFont.SetUnderline(toBool(rValue) ? LINESTYLE_SINGLE : LINESTYLE_NONE); SetControlFont(aFont); } + else if (rKey == "scale") + { + // if no control font was set yet, take the underlying font from the device + vcl::Font aFont(IsControlFont() ? GetControlFont() : GetPointFont(*GetOutDev())); + aFont.SetFontHeight(aFont.GetFontHeight() * o3tl::toDouble(rValue)); + SetControlFont(aFont); + } else if (rKey == "size") { vcl::Font aFont(GetControlFont());