Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #pragma once
20 :
21 : #include <vcl/dllapi.h>
22 :
23 : #include "outfont.hxx"
24 :
25 : class ImplFontEntry;
26 : struct FontMatchStatus;
27 : class FontSelectPattern;
28 : class PhysicalFontFamily;
29 :
30 : struct FontMatchStatus
31 : {
32 : public:
33 : int mnFaceMatch;
34 : int mnHeightMatch;
35 : int mnWidthMatch;
36 : const OUString* mpTargetStyleName;
37 : };
38 :
39 : // - PhysicalFontFace -
40 :
41 : // TODO: no more direct access to members
42 : // TODO: add reference counting
43 : // TODO: get rid of height/width for scalable fonts
44 : // TODO: make cloning cheaper
45 :
46 : // abstract base class for physical font faces
47 0 : class VCL_PLUGIN_PUBLIC PhysicalFontFace : public ImplDevFontAttributes
48 : {
49 : public:
50 : // by using an PhysicalFontFace object as a factory for its corresponding
51 : // ImplFontEntry an ImplFontEntry can be extended to cache device and
52 : // font instance specific data
53 : virtual ImplFontEntry* CreateFontInstance( FontSelectPattern& ) const = 0;
54 :
55 0 : virtual int GetHeight() const { return mnHeight; }
56 0 : virtual int GetWidth() const { return mnWidth; }
57 : virtual sal_IntPtr GetFontId() const = 0;
58 0 : int GetFontMagic() const { return mnMagic; }
59 0 : bool IsScalable() const { return (mnHeight == 0); }
60 0 : bool CheckMagic( int n ) const { return (n == mnMagic); }
61 0 : PhysicalFontFace* GetNextFace() const { return mpNext; }
62 : PhysicalFontFace* CreateAlias() const { return Clone(); }
63 :
64 : bool IsBetterMatch( const FontSelectPattern&, FontMatchStatus& ) const;
65 : sal_Int32 CompareWithSize( const PhysicalFontFace& ) const;
66 : sal_Int32 CompareIgnoreSize( const PhysicalFontFace& ) const;
67 0 : virtual ~PhysicalFontFace() {}
68 : virtual PhysicalFontFace* Clone() const = 0;
69 :
70 : protected:
71 : explicit PhysicalFontFace( const ImplDevFontAttributes&, int nMagic );
72 : void SetBitmapSize( int nW, int nH ) { mnWidth=nW; mnHeight=nH; }
73 :
74 : long mnWidth; // Width (in pixels)
75 : long mnHeight; // Height (in pixels)
76 :
77 : private:
78 : friend class PhysicalFontFamily;
79 : const int mnMagic; // poor man's RTTI
80 : PhysicalFontFace* mpNext;
81 : };
82 :
83 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
84 :
|