[Libreoffice-commits] core.git: vcl/Library_vcl.mk vcl/source

Chris Sherlock chris.sherlock79 at gmail.com
Thu Jan 7 01:02:20 PST 2016


 vcl/Library_vcl.mk             |    1 
 vcl/source/font/fontselect.cxx |  173 +++++++++++++++++++++++++++++++++++++++++
 vcl/source/outdev/font.cxx     |  107 -------------------------
 3 files changed, 174 insertions(+), 107 deletions(-)

New commits:
commit 8b8bbb43ab66b4b4398e59316958a3dc44bcf775
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Thu Jan 7 17:59:40 2016 +1100

    vcl: move FontSelectPattern[Attributes] to fontselect.cxx
    
    Change-Id: I41361d8dd4619a27bba5cc9ad2c627b37f1b2013
    Reviewed-on: https://gerrit.libreoffice.org/21190
    Reviewed-by: Chris Sherlock <chris.sherlock79 at gmail.com>
    Tested-by: Chris Sherlock <chris.sherlock79 at gmail.com>

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 18f70ba..27142a0 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -393,6 +393,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/font/PhysicalFontCollection \
     vcl/source/font/PhysicalFontFace \
     vcl/source/font/PhysicalFontFamily \
+    vcl/source/font/fontselect \
     vcl/source/fontsubset/cff \
     vcl/source/fontsubset/fontsubset \
     vcl/source/fontsubset/gsub \
diff --git a/vcl/source/font/fontselect.cxx b/vcl/source/font/fontselect.cxx
new file mode 100644
index 0000000..5bcc3e4
--- /dev/null
+++ b/vcl/source/font/fontselect.cxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "i18nlangtag/mslangid.hxx"
+
+#include <unotools/configmgr.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/print.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/sysdata.hxx>
+#include <vcl/fontcharmap.hxx>
+
+#include "sallayout.hxx"
+#include "svdata.hxx"
+
+#include "impfont.hxx"
+#include "outdata.hxx"
+#include "fontentry.hxx"
+#include "fontattributes.hxx"
+
+#include "outdev.h"
+#include "window.h"
+
+#include "PhysicalFontCollection.hxx"
+#include "PhysicalFontFace.hxx"
+#include "PhysicalFontFamily.hxx"
+
+#include "svids.hrc"
+
+#include <config_graphite.h>
+#if ENABLE_GRAPHITE
+#include "graphite_features.hxx"
+#endif
+
+#include "../gdi/pdfwriter_impl.hxx"
+
+#include <boost/functional/hash.hpp>
+#include <cmath>
+#include <cstring>
+#include <memory>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::rtl;
+using namespace ::utl;
+
+FontSelectPattern::FontSelectPattern( const vcl::Font& rFont,
+    const OUString& rSearchName, const Size& rSize, float fExactHeight)
+    : FontSelectPatternAttributes(rFont, rSearchName, rSize, fExactHeight)
+    , mpFontData( nullptr )
+    , mpFontEntry( nullptr )
+{
+}
+
+// NOTE: this ctor is still used on Windows. Do not remove.
+#ifdef WNT
+FontSelectPatternAttributes::FontSelectPatternAttributes( const PhysicalFontFace& rFontData,
+    const Size& rSize, float fExactHeight, int nOrientation, bool bVertical )
+    : ImplFontAttributes( rFontData )
+    , mnWidth( rSize.Width() )
+    , mnHeight( rSize.Height() )
+    , mfExactHeight( fExactHeight )
+    , mnOrientation( nOrientation )
+    , meLanguage( 0 )
+    , mbVertical( bVertical )
+    , mbNonAntialiased( false )
+    , mbEmbolden( false )
+{
+    maTargetName = maSearchName = GetFamilyName();
+    // NOTE: no normalization for width/height/orientation
+}
+
+FontSelectPattern::FontSelectPattern( const PhysicalFontFace& rFontData,
+    const Size& rSize, float fExactHeight, int nOrientation, bool bVertical )
+    : FontSelectPatternAttributes(rFontData, rSize, fExactHeight, nOrientation, bVertical)
+    , mpFontData( &rFontData )
+    , mpFontEntry( NULL )
+{
+}
+#endif
+
+void FontSelectPattern::copyAttributes(const FontSelectPatternAttributes &rAttributes)
+{
+    static_cast<FontSelectPatternAttributes&>(*this) = rAttributes;
+}
+
+size_t FontSelectPatternAttributes::hashCode() const
+{
+    // TODO: does it pay off to improve this hash function?
+    size_t nHash;
+#if ENABLE_GRAPHITE
+    // check for features and generate a unique hash if necessary
+    if (maTargetName.indexOf(grutils::GrFeatureParser::FEAT_PREFIX)
+        != -1)
+    {
+        nHash = maTargetName.hashCode();
+    }
+    else
+#endif
+    {
+        nHash = maSearchName.hashCode();
+    }
+    nHash += 11 * mnHeight;
+    nHash += 19 * GetWeight();
+    nHash += 29 * GetSlantType();
+    nHash += 37 * mnOrientation;
+    nHash += 41 * meLanguage;
+    if( mbVertical )
+        nHash += 53;
+    return nHash;
+}
+
+bool FontSelectPatternAttributes::operator==(const FontSelectPatternAttributes& rOther) const
+{
+    if (!CompareDeviceIndependentFontAttributes(rOther))
+        return false;
+
+    if (maTargetName != rOther.maTargetName)
+        return false;
+
+    if (maSearchName != rOther.maSearchName)
+        return false;
+
+    if (mnWidth != rOther.mnWidth)
+        return false;
+
+    if (mnHeight != rOther.mnHeight)
+        return false;
+
+    if (mfExactHeight != rOther.mfExactHeight)
+        return false;
+
+    if (mnOrientation != rOther.mnOrientation)
+        return false;
+
+    if (meLanguage != rOther.meLanguage)
+        return false;
+
+    if (mbVertical != rOther.mbVertical)
+        return false;
+
+    if (mbNonAntialiased != rOther.mbNonAntialiased)
+        return false;
+
+    if (mbEmbolden != rOther.mbEmbolden)
+        return false;
+
+    if (maItalicMatrix != rOther.maItalicMatrix)
+        return false;
+
+    return true;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 40e12c9..915cc89 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1071,118 +1071,11 @@ FontSelectPatternAttributes::FontSelectPatternAttributes( const vcl::Font& rFont
         mnWidth = -mnWidth;
 }
 
-FontSelectPattern::FontSelectPattern( const vcl::Font& rFont,
-    const OUString& rSearchName, const Size& rSize, float fExactHeight)
-    : FontSelectPatternAttributes(rFont, rSearchName, rSize, fExactHeight)
-    , mpFontData( nullptr )
-    , mpFontEntry( nullptr )
-{
-}
-
-// NOTE: this ctor is still used on Windows. Do not remove.
-#ifdef WNT
-FontSelectPatternAttributes::FontSelectPatternAttributes( const PhysicalFontFace& rFontData,
-    const Size& rSize, float fExactHeight, int nOrientation, bool bVertical )
-    : ImplFontAttributes( rFontData )
-    , mnWidth( rSize.Width() )
-    , mnHeight( rSize.Height() )
-    , mfExactHeight( fExactHeight )
-    , mnOrientation( nOrientation )
-    , meLanguage( 0 )
-    , mbVertical( bVertical )
-    , mbNonAntialiased( false )
-    , mbEmbolden( false )
-{
-    maTargetName = maSearchName = GetFamilyName();
-    // NOTE: no normalization for width/height/orientation
-}
-
-FontSelectPattern::FontSelectPattern( const PhysicalFontFace& rFontData,
-    const Size& rSize, float fExactHeight, int nOrientation, bool bVertical )
-    : FontSelectPatternAttributes(rFontData, rSize, fExactHeight, nOrientation, bVertical)
-    , mpFontData( &rFontData )
-    , mpFontEntry( NULL )
-{
-}
-#endif
-
-void FontSelectPattern::copyAttributes(const FontSelectPatternAttributes &rAttributes)
-{
-    static_cast<FontSelectPatternAttributes&>(*this) = rAttributes;
-}
-
 size_t ImplFontCache::IFSD_Hash::operator()( const FontSelectPattern& rFSD ) const
 {
     return rFSD.hashCode();
 }
 
-size_t FontSelectPatternAttributes::hashCode() const
-{
-    // TODO: does it pay off to improve this hash function?
-    size_t nHash;
-#if ENABLE_GRAPHITE
-    // check for features and generate a unique hash if necessary
-    if (maTargetName.indexOf(grutils::GrFeatureParser::FEAT_PREFIX)
-        != -1)
-    {
-        nHash = maTargetName.hashCode();
-    }
-    else
-#endif
-    {
-        nHash = maSearchName.hashCode();
-    }
-    nHash += 11 * mnHeight;
-    nHash += 19 * GetWeight();
-    nHash += 29 * GetSlantType();
-    nHash += 37 * mnOrientation;
-    nHash += 41 * meLanguage;
-    if( mbVertical )
-        nHash += 53;
-    return nHash;
-}
-
-bool FontSelectPatternAttributes::operator==(const FontSelectPatternAttributes& rOther) const
-{
-    if (!CompareDeviceIndependentFontAttributes(rOther))
-        return false;
-
-    if (maTargetName != rOther.maTargetName)
-        return false;
-
-    if (maSearchName != rOther.maSearchName)
-        return false;
-
-    if (mnWidth != rOther.mnWidth)
-        return false;
-
-    if (mnHeight != rOther.mnHeight)
-        return false;
-
-    if (mfExactHeight != rOther.mfExactHeight)
-        return false;
-
-    if (mnOrientation != rOther.mnOrientation)
-        return false;
-
-    if (meLanguage != rOther.meLanguage)
-        return false;
-
-    if (mbVertical != rOther.mbVertical)
-        return false;
-
-    if (mbNonAntialiased != rOther.mbNonAntialiased)
-        return false;
-
-    if (mbEmbolden != rOther.mbEmbolden)
-        return false;
-
-    if (maItalicMatrix != rOther.maItalicMatrix)
-        return false;
-
-    return true;
-}
-
 bool ImplFontCache::IFSD_Equal::operator()(const FontSelectPattern& rA, const FontSelectPattern& rB) const
 {
     // check normalized font family name


More information about the Libreoffice-commits mailing list