summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-01-03 14:43:58 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-01-03 18:57:55 +0100
commit67d5b5b3d16711956025df0a742fe06b7fb3d0f9 (patch)
tree7872fde56f0d2f7b0ac86b3a062499e8f3804f26 /vcl
parent26a46c1143e34e361d76d6459535c2056c59de77 (diff)
Avoid -Werror,-Wdeprecated-enum-float-conversion
...with Clang 10 trunk: > vcl/quartz/ctfonts.cxx:414:35: error: arithmetic between enumeration type 'FontWeight' and floating-point type 'double' is deprecated [-Werror,-Wdeprecated-enum-float-conversion] > nInt = rint(WEIGHT_NORMAL + fWeight * ((WEIGHT_BLACK - WEIGHT_NORMAL)/0.68)); > ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ etc. These computations had been introduced with ea8422d42e838e7ddfeb8d9f77f3ecedecb29ce8 "Cherry-pick Core Text port from AOO", and it looks like they indeed want to compute a suitable value in the WEIGHT_THIN (=1), ..., WEIGHT_BLACK (=10) range of enum FontWeight, resp. the WIDTH_ULRA_CONDENSED (=1), ..., WIDTH_ULTRA_EXPANDED (=9) range of enum FontWidth (rather than, say, float values in the THIN = 50.0, ..., BLACK = 200.0 constants range of css.awt.FontWeight, resp. the ULTRACONDENSED = 50.0, ..., ULTRAEXPANDED = 200.0 constants range of css.awt.FontWidth). Change-Id: I054e4e215331f84cea03de681aa4b0fb7c12eef5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86176 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/quartz/ctfonts.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 4f9657b993b4..b0e9e8f5644a 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -411,7 +411,7 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont
if( fWeight > 0 )
{
- nInt = rint(WEIGHT_NORMAL + fWeight * ((WEIGHT_BLACK - WEIGHT_NORMAL)/0.68));
+ nInt = rint(int(WEIGHT_NORMAL) + fWeight * ((WEIGHT_BLACK - WEIGHT_NORMAL)/0.68));
if( nInt > WEIGHT_BLACK )
{
nInt = WEIGHT_BLACK;
@@ -419,7 +419,7 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont
}
else if( fWeight < 0 )
{
- nInt = rint(WEIGHT_NORMAL + fWeight * ((WEIGHT_NORMAL - WEIGHT_THIN)/0.8));
+ nInt = rint(int(WEIGHT_NORMAL) + fWeight * ((WEIGHT_NORMAL - WEIGHT_THIN)/0.8));
if( nInt < WEIGHT_THIN )
{
nInt = WEIGHT_THIN;
@@ -443,7 +443,7 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont
if( fWidth > 0 )
{
- nInt = rint( WIDTH_NORMAL + fWidth * ((WIDTH_ULTRA_EXPANDED - WIDTH_NORMAL)/0.4));
+ nInt = rint( int(WIDTH_NORMAL) + fWidth * ((WIDTH_ULTRA_EXPANDED - WIDTH_NORMAL)/0.4));
if( nInt > WIDTH_ULTRA_EXPANDED )
{
nInt = WIDTH_ULTRA_EXPANDED;
@@ -451,7 +451,7 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont
}
else if( fWidth < 0 )
{
- nInt = rint( WIDTH_NORMAL + fWidth * ((WIDTH_NORMAL - WIDTH_ULTRA_CONDENSED)/0.5));
+ nInt = rint( int(WIDTH_NORMAL) + fWidth * ((WIDTH_NORMAL - WIDTH_ULTRA_CONDENSED)/0.5));
if( nInt < WIDTH_ULTRA_CONDENSED )
{
nInt = WIDTH_ULTRA_CONDENSED;