Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / vcl / inc / PhysicalFontFace.hxx
blob051ffcb6c2880d5bf09b7db2967d173c397aed1e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
21 #define INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
23 #include <vcl/dllapi.h>
25 #include "fontinstance.hxx"
26 #include "fontattributes.hxx"
27 #include "fontselect.hxx"
29 class LogicalFontInstance;
30 struct FontMatchStatus;
31 class FontSelectPattern;
32 class PhysicalFontFamily;
34 struct FontMatchStatus
36 public:
37 int mnFaceMatch;
38 int mnHeightMatch;
39 int mnWidthMatch;
40 const OUString* mpTargetStyleName;
44 // TODO: no more direct access to members
45 // TODO: add reference counting
46 // TODO: get rid of height/width for scalable fonts
47 // TODO: make cloning cheaper
49 // abstract base class for physical font faces
51 // Note about physical and logical fonts:
53 // A physical font is a concept we have taken from the Java world
55 // From https://docs.oracle.com/javase/tutorial/2d/text/fonts.html
57 // There are two types of fonts: physical fonts and logical fonts.
58 // Physical fonts are the actual font libraries consisting of, for
59 // example, TrueType or PostScript Type 1 fonts. The physical fonts
60 // may be Time, Helvetica, Courier, or any number of other fonts,
61 // including international fonts. Logical fonts are the following
62 // five font families: Serif, SansSerif, Monospaced, Dialog, and
63 // DialogInput. These logical fonts are not actual font libraries.
64 // Instead, the logical font names are mapped to physical fonts by
65 // the Java runtime environment.
67 class VCL_PLUGIN_PUBLIC PhysicalFontFace : public FontAttributes
69 public:
70 virtual ~PhysicalFontFace() {}
72 // by using an PhysicalFontFace object as a factory for its corresponding
73 // LogicalFontInstance can be extended to cache device and font instance
74 // specific data
75 virtual LogicalFontInstance* CreateFontInstance( FontSelectPattern& ) const = 0;
76 virtual PhysicalFontFace* Clone() const = 0;
78 int GetHeight() const { return mnHeight; }
79 int GetWidth() const { return mnWidth; }
80 virtual sal_IntPtr GetFontId() const = 0;
82 bool IsBetterMatch( const FontSelectPattern&, FontMatchStatus& ) const;
83 sal_Int32 CompareWithSize( const PhysicalFontFace& ) const;
84 sal_Int32 CompareIgnoreSize( const PhysicalFontFace& ) const;
86 protected:
87 explicit PhysicalFontFace( const FontAttributes& );
88 void SetBitmapSize( int nW, int nH ) { mnWidth=nW; mnHeight=nH; }
90 long mnWidth; // Width (in pixels)
91 long mnHeight; // Height (in pixels)
94 #endif // INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */