[Libreoffice-commits] core.git: vcl/quartz

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 3 17:58:33 UTC 2020


 vcl/quartz/ctfonts.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 67d5b5b3d16711956025df0a742fe06b7fb3d0f9
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jan 3 14:43:58 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jan 3 18:57:55 2020 +0100

    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 at redhat.com>

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;


More information about the Libreoffice-commits mailing list