summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-02-03 10:13:00 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-02-04 03:17:26 +0000
commit697d445ed0c7b60e463243db89af32e2145b475b (patch)
tree5a74d57cdc97f82bc78a686dee345a229a082a72 /cui
parent91a7580e03d5b47c6e2513afce85ddee45e730b6 (diff)
vcl: take into account the font width is the average font width
I'm changing the Font class function names: - SetSize -> SetFontSize - GetSize -> GetFontSize - SetHeight -> SetFontHeight - GetHeight -> GetFontHeight - SetWidth -> SetAverageFontWidth - GetWidth -> GetAverageFontWidth That's because it really makes no sense to say that there is a single constant font width because obviously proportional fonts don't have one - the best we can do is an average font width, which is what folks like Microsoft sort of do already. On a fixed font, the average is still accurate, for obvious reasons :-) I'm also not a fan of GetSize/SetSize as I find it a might too generic. Change-Id: Ib80a604ba62d6883fd6cbc7994da763976be5c70 Reviewed-on: https://gerrit.libreoffice.org/22069 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/about.cxx6
-rw-r--r--cui/source/dialogs/cuicharmap.cxx10
-rw-r--r--cui/source/dialogs/hangulhanjadlg.cxx4
-rw-r--r--cui/source/tabpages/autocdlg.cxx2
-rw-r--r--cui/source/tabpages/chardlg.cxx28
-rw-r--r--cui/source/tabpages/numpages.cxx8
6 files changed, 29 insertions, 29 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 0e6ca41a67a4..f26a1761ca2a 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -162,17 +162,17 @@ void AboutDialog::StyleControls()
vcl::Font aLabelFont = rStyleSettings.GetLabelFont();
vcl::Font aLargeFont = aLabelFont;
- aLargeFont.SetSize(Size( 0, aLabelFont.GetSize().Height() * 3));
+ aLargeFont.SetFontSize(Size( 0, aLabelFont.GetFontSize().Height() * 3));
// Logo Replacement Text
m_pLogoReplacement->SetControlFont(aLargeFont);
// Description Text
- aLargeFont.SetSize(Size(0, aLabelFont.GetSize().Height() * 1.3));
+ aLargeFont.SetFontSize(Size(0, aLabelFont.GetFontSize().Height() * 1.3));
m_pDescriptionText->SetControlFont(aLargeFont);
// Version Text
- aLargeFont.SetSize(Size(0, aLabelFont.GetSize().Height() * 1.2));
+ aLargeFont.SetFontSize(Size(0, aLabelFont.GetFontSize().Height() * 1.2));
m_pVersion->SetControlFont(aLargeFont);
// If not in high-contrast mode, hard-code colors
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index b8d28a871a27..c8a5a28ada93 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -88,7 +88,7 @@ SvxCharacterMap::SvxCharacterMap( vcl::Window* pParent, bool bOne_, const SfxIte
const SfxStringItem* pFontNameItem = SfxItemSet::GetItem<SfxStringItem>(pSet, SID_FONT_NAME, false);
if ( pFontItem )
{
- vcl::Font aTmpFont( pFontItem->GetFamilyName(), pFontItem->GetStyleName(), GetCharFont().GetSize() );
+ vcl::Font aTmpFont( pFontItem->GetFamilyName(), pFontItem->GetStyleName(), GetCharFont().GetFontSize() );
aTmpFont.SetCharSet( pFontItem->GetCharSet() );
aTmpFont.SetPitch( pFontItem->GetPitch() );
SetCharFont( aTmpFont );
@@ -204,7 +204,7 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
bool bGotBoundary = true;
bool bShrankFont = false;
vcl::Font aOrigFont(rRenderContext.GetFont());
- Size aFontSize(aOrigFont.GetSize());
+ Size aFontSize(aOrigFont.GetFontSize());
Rectangle aBoundRect;
for (long nFontHeight = aFontSize.Height(); nFontHeight > 0; nFontHeight -= 5)
@@ -222,7 +222,7 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
break;
vcl::Font aFont(aOrigFont);
aFontSize.Height() = nFontHeight;
- aFont.SetSize(aFontSize);
+ aFont.SetFontSize(aFontSize);
rRenderContext.SetFont(aFont);
mnY = (nWinHeight - GetTextHeight()) / 2;
bShrankFont = true;
@@ -276,7 +276,7 @@ void SvxShowText::SetFont( const vcl::Font& rFont )
maFont = vcl::Font(rFont);
maFont.SetWeight(WEIGHT_NORMAL);
maFont.SetAlignment(ALIGN_TOP);
- maFont.SetSize(PixelToLogic(Size(0, nWinHeight / 2)));
+ maFont.SetFontSize(PixelToLogic(Size(0, nWinHeight / 2)));
maFont.SetTransparent(true);
Control::SetFont(maFont);
@@ -288,7 +288,7 @@ void SvxShowText::SetFont( const vcl::Font& rFont )
Size SvxShowText::GetOptimalSize() const
{
const vcl::Font &rFont = GetFont();
- const Size rFontSize = rFont.GetSize();
+ const Size rFontSize = rFont.GetFontSize();
long nWinHeight = LogicToPixel(rFontSize).Height() * 2;
return Size( GetTextWidth( GetText() ) + 2 * 12, nWinHeight );
}
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 0be8100cee7d..8bd4398f5cb2 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -130,7 +130,7 @@ namespace svx
// the font for the secondary text:
vcl::Font aSmallerFont(rRenderContext.GetFont());
// heuristic: 80% of the original size
- aSmallerFont.SetHeight( (long)( 0.8 * aSmallerFont.GetHeight() ) );
+ aSmallerFont.SetFontHeight( (long)( 0.8 * aSmallerFont.GetFontHeight() ) );
// let's calculate the size of our two texts
Rectangle aPrimaryRect = rRenderContext.GetTextRect( _rRect, m_sPrimaryText, _nTextStyle );
@@ -309,7 +309,7 @@ namespace svx
Size RubyRadioButton::GetOptimalSize() const
{
vcl::Font aSmallerFont( GetFont() );
- aSmallerFont.SetHeight( static_cast<long>( 0.8 * aSmallerFont.GetHeight() ) );
+ aSmallerFont.SetFontHeight( static_cast<long>( 0.8 * aSmallerFont.GetFontHeight() ) );
Rectangle rect( Point(), Size( SAL_MAX_INT32, SAL_MAX_INT32 ) );
Size aPrimarySize = GetTextRect( rect, m_aRubyText.getPrimaryText() ).GetSize();
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index cf7af4a9cc8e..cb0932ab88a8 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -351,7 +351,7 @@ void OfaImpBrwString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::Ren
{
aFont = *pUserData->pFont;
aFont.SetColor(aOldFont.GetColor());
- aFont.SetSize(aOldFont.GetSize());
+ aFont.SetFontSize(aOldFont.GetFontSize());
}
aFont.SetWeight(WEIGHT_BOLD);
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index ba3f6204cff1..42150e41fcd2 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -484,7 +484,7 @@ namespace
sal_uInt16 _nFontWhich,
sal_uInt16 _nFontHeightWhich)
{
- Size aSize = _rFont.GetSize();
+ Size aSize = _rFont.GetFontSize();
aSize.Width() = 0;
FontMetric aFontMetrics;
OUString sFontName(_pFontNameLB->GetText());
@@ -525,7 +525,7 @@ namespace
aSize.Height() = PointToTwips( static_cast<long>(_pFontSizeLB->GetValue() / 10) );
else
aSize.Height() = 200; // default 10pt
- aFontMetrics.SetSize( aSize );
+ aFontMetrics.SetFontSize( aSize );
_rFont.SetLanguage(_pLanguageLB->GetSelectLanguage());
@@ -536,7 +536,7 @@ namespace
_rFont.SetCharSet( aFontMetrics.GetCharSet() );
_rFont.SetWeight( aFontMetrics.GetWeight() );
_rFont.SetItalic( aFontMetrics.GetItalic() );
- _rFont.SetSize( aFontMetrics.GetSize() );
+ _rFont.SetFontSize( aFontMetrics.GetFontSize() );
return aFontMetrics;
}
@@ -550,11 +550,11 @@ void SvxCharNamePage::UpdatePreview_Impl()
SvxFont& rCJKFont = GetPreviewCJKFont();
SvxFont& rCTLFont = GetPreviewCTLFont();
// Size
- Size aSize = rFont.GetSize();
+ Size aSize = rFont.GetFontSize();
aSize.Width() = 0;
- Size aCJKSize = rCJKFont.GetSize();
+ Size aCJKSize = rCJKFont.GetFontSize();
aCJKSize.Width() = 0;
- Size aCTLSize = rCTLFont.GetSize();
+ Size aCTLSize = rCTLFont.GetFontSize();
aCTLSize.Width() = 0;
// Font
const FontList* pFontList = GetFontList();
@@ -2710,9 +2710,9 @@ void SvxCharPositionPage::Initialize()
// to handle the changes of the other pages
SetExchangeSupport();
- GetPreviewFont().SetSize( Size( 0, 240 ) );
- GetPreviewCJKFont().SetSize( Size( 0, 240 ) );
- GetPreviewCTLFont().SetSize( Size( 0, 240 ) );
+ GetPreviewFont().SetFontSize( Size( 0, 240 ) );
+ GetPreviewCJKFont().SetFontSize( Size( 0, 240 ) );
+ GetPreviewCTLFont().SetFontSize( Size( 0, 240 ) );
m_pNormalPosBtn->Check();
PositionHdl_Impl( m_pNormalPosBtn );
@@ -2876,7 +2876,7 @@ IMPL_LINK_NOARG_TYPED(SvxCharPositionPage, KerningSelectHdl_Impl, ListBox&, void
{
// Condensed -> max value == 1/6 of the current font height
SvxFont& rFont = GetPreviewFont();
- long nMax = rFont.GetSize().Height() / 6;
+ long nMax = rFont.GetFontSize().Height() / 6;
m_pKerningMF->SetMax( m_pKerningMF->Normalize( nMax ), FUNIT_TWIP );
m_pKerningMF->SetLast( m_pKerningMF->GetMax( m_pKerningMF->GetUnit() ) );
}
@@ -2961,7 +2961,7 @@ void SvxCharPositionPage::ActivatePage( const SfxItemSet& rSet )
{
// Condensed -> max value == 1/6 of the current font height
SvxFont& rFont = GetPreviewFont();
- long nMax = rFont.GetSize().Height() / 6;
+ long nMax = rFont.GetFontSize().Height() / 6;
long nKern = (short)m_pKerningMF->Denormalize( LogicToLogic( static_cast<long>(m_pKerningMF->GetValue()), MAP_POINT, MAP_TWIP ) );
m_pKerningMF->SetMax( m_pKerningMF->Normalize( nKern > nMax ? nKern : nMax ), FUNIT_TWIP );
m_pKerningMF->SetLast( m_pKerningMF->GetMax( m_pKerningMF->GetUnit() ) );
@@ -3445,9 +3445,9 @@ void SvxCharTwoLinesPage::Initialize()
SvxFont& rFont = GetPreviewFont();
SvxFont& rCJKFont = GetPreviewCJKFont();
SvxFont& rCTLFont = GetPreviewCTLFont();
- rFont.SetSize( Size( 0, 220 ) );
- rCJKFont.SetSize( Size( 0, 220 ) );
- rCTLFont.SetSize( Size( 0, 220 ) );
+ rFont.SetFontSize( Size( 0, 220 ) );
+ rCJKFont.SetFontSize( Size( 0, 220 ) );
+ rCTLFont.SetFontSize( Size( 0, 220 ) );
}
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 325f93012c5b..2312f379f06d 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -2413,7 +2413,7 @@ static sal_uInt16 lcl_DrawBullet(VirtualDevice* pVDev,
// in case of a height of zero it is drawed in original height
if(!aTmpSize.Height())
aTmpSize.Height() = 1;
- aFont.SetSize(aTmpSize);
+ aFont.SetFontSize(aTmpSize);
aFont.SetTransparent(true);
Color aBulletColor = rFmt.GetBulletColor();
if(aBulletColor.GetColor() == COL_AUTO)
@@ -2494,7 +2494,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const Rectan
sal_uInt16 nFontHeight = nYStep * 6 / 10;
if (bPosition)
nFontHeight = nYStep * 15 / 10;
- aStdFont.SetSize(Size( 0, nFontHeight ));
+ aStdFont.SetFontSize(Size( 0, nFontHeight ));
SvxNodeNum aNum(sal_uInt8(0));
sal_uInt16 nPreNum = pActNum->GetLevel(0).GetStart();
@@ -2553,7 +2553,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const Rectan
}
else if (SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
{
- nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawBullet(pVDev.get(), rFmt, nNumberXPos, nYStart, aStdFont.GetSize()) : 0;
+ nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawBullet(pVDev.get(), rFmt, nNumberXPos, nYStart, aStdFont.GetFontSize()) : 0;
}
else
{
@@ -2676,7 +2676,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const Rectan
{
if (rFmt.IsShowSymbol())
{
- nTextOffset = lcl_DrawBullet(pVDev.get(), rFmt, nXStart, nYStart, aStdFont.GetSize());
+ nTextOffset = lcl_DrawBullet(pVDev.get(), rFmt, nXStart, nYStart, aStdFont.GetFontSize());
nTextOffset = nTextOffset + nXStep;
}
}