From 599ab8dc3ae9d8b8749b6400e87d98a6dad2a03c Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Wed, 19 Mar 2025 13:23:22 +0500 Subject: Rename con-const vcl::Font property getters for clarity There are two sets of getters there; and the non-const ones may copy the COW mpImplFont, and may call its AskConfig. The name overload is unfortunate. It is not obvious at the call site, which of the two will be called; and what is different. IMO, the way to fix it would be to keep only one set of getters (the const one), and make the call to AskConfig explicit (in the places that set font name, and know that resolution of other properties will be needed). But in this change, I only rename the non-const getters, making sure to keep the behavior unchanged (at least the intention is to have a non-functional change, meaning that the places that called non-const overload, now use the renamed functions), to make it clear where we actually may copy and initialize it. Change-Id: I9a5cd91d5c1c0de7ff8577b9b982d165e4cdd2c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183116 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- vcl/source/font/font.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'vcl/source/font/font.cxx') diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index c47fb0bbac4d..d84d2d28e6a2 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -368,7 +368,6 @@ void Font::Merge( const vcl::Font& rFont ) SetCharSet( rFont.GetCharSet() ); SetLanguageTag( rFont.GetLanguageTag() ); SetCJKContextLanguageTag( rFont.GetCJKContextLanguageTag() ); - // don't use access methods here, might lead to AskConfig(), if DONTKNOW SetFamily( rFont.GetFamilyType() ); SetPitch( rFont.GetPitch() ); } @@ -926,11 +925,11 @@ Degree10 Font::GetOrientation() const { return mpImplFont->mnOrientation; } bool Font::IsVertical() const { return mpImplFont->mbVertical; } FontKerning Font::GetKerning() const { return mpImplFont->meKerning; } -FontPitch Font::GetPitch() { return mpImplFont->GetPitch(); } -FontWeight Font::GetWeight() { return mpImplFont->GetWeight(); } -FontWidth Font::GetWidthType() { return mpImplFont->GetWidthType(); } -FontItalic Font::GetItalic() { return mpImplFont->GetItalic(); } -FontFamily Font::GetFamilyType() { return mpImplFont->GetFamilyType(); } +FontPitch Font::GetPitchMaybeAskConfig() { return mpImplFont->GetPitch(); } +FontWeight Font::GetWeightMaybeAskConfig() { return mpImplFont->GetWeight(); } +FontWidth Font::GetWidthTypeMaybeAskConfig() { return mpImplFont->GetWidthType(); } +FontItalic Font::GetItalicMaybeAskConfig() { return mpImplFont->GetItalic(); } +FontFamily Font::GetFamilyTypeMaybeAskConfig() { return mpImplFont->GetFamilyType(); } FontPitch Font::GetPitch() const { return mpImplFont->GetPitchNoAsk(); } FontWeight Font::GetWeight() const { return mpImplFont->GetWeightNoAsk(); } -- cgit