LibreOffice Module vcl (master)  1
winlayout.hxx
Go to the documentation of this file.
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 
20 #pragma once
21 
22 #include <sal/config.h>
23 
24 #include <rtl/ustring.hxx>
25 
26 #include <sallayout.hxx>
27 #include <svsys.h>
28 #include <win/salgdi.h>
29 #include <o3tl/sorted_vector.hxx>
30 
31 // win32 specific logical font instance
33 {
35 
36 public:
37  ~WinFontInstance() override;
38 
39  bool hasHScale() const;
40  float getHScale() const;
41 
43  WinSalGraphics* GetGraphics() const { return m_pGraphics; }
44 
45  HFONT GetHFONT() const { return m_hFont; }
46  float GetScale() const { return m_fScale; }
47  // Return true if the font is for vertical writing.
48  // I.e. the font name of the LOGFONT is prefixed with '@'.
49  bool IsCJKVerticalFont() const { return m_bIsCJKVerticalFont; }
50  sal_Int32 GetTmDescent() const { return m_nTmDescent; }
51 
52  const WinFontFace * GetFontFace() const { return static_cast<const WinFontFace *>(LogicalFontInstance::GetFontFace()); }
54 
55  bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override;
56 
57 private:
59 
60  hb_font_t* ImplInitHbFont() override;
61  bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override;
62 
64  HFONT m_hFont;
65  float m_fScale;
67  sal_Int32 m_nTmDescent;
68 };
69 
71 {
72 protected:
73  explicit TextOutRenderer() = default;
74  TextOutRenderer(const TextOutRenderer &) = delete;
75  TextOutRenderer & operator = (const TextOutRenderer &) = delete;
76 
77 public:
78  static TextOutRenderer & get(bool bUseDWrite, bool bRenderingModeNatural);
79 
80  virtual ~TextOutRenderer() = default;
81 
82  virtual bool operator ()(GenericSalLayout const &rLayout,
83  SalGraphics &rGraphics,
84  HDC hDC,
85  bool bRenderingModeNatural) = 0;
86 };
87 
89 {
90  ExTextOutRenderer(const ExTextOutRenderer &) = delete;
92 
93 public:
94  explicit ExTextOutRenderer() = default;
95 
96  bool operator ()(GenericSalLayout const &rLayout,
97  SalGraphics &rGraphics,
98  HDC hDC,
99  bool bRenderingModeNatural) override;
100 };
101 
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool m_bIsCJKVerticalFont
Definition: winlayout.hxx:66
bool IsCJKVerticalFont() const
Definition: winlayout.hxx:49
WinFontInstance(const WinFontFace &, const vcl::font::FontSelectPattern &)
virtual ~TextOutRenderer()=default
WinSalGraphics * GetGraphics() const
Definition: winlayout.hxx:43
bool operator()(GenericSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC, bool bRenderingModeNatural) override
bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle &, bool) const override
bool hasHScale() const
TextOutRenderer & operator=(const TextOutRenderer &)=delete
sal_uInt16 sal_GlyphId
Definition: glyphid.hxx:24
TextOutRenderer()=default
bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon &, bool) const override
~WinFontInstance() override
void SetGraphics(WinSalGraphics *)
sal_Int32 GetTmDescent() const
Definition: winlayout.hxx:50
float getHScale() const
const WinFontFace * GetFontFace() const
Definition: winlayout.hxx:52
sal_Int32 m_nTmDescent
Definition: winlayout.hxx:67
ExTextOutRenderer()=default
ExTextOutRenderer & operator=(const ExTextOutRenderer &)=delete
WinFontFace * GetFontFace()
Definition: winlayout.hxx:53
WinSalGraphics * m_pGraphics
Definition: winlayout.hxx:63
WinSalGraphics never owns the HDC it uses to draw, because the HDC can have various origins with diff...
Definition: win/salgdi.h:151
virtual rtl::Reference< LogicalFontInstance > CreateFontInstance(const vcl::font::FontSelectPattern &) const override
HFONT GetHFONT() const
Definition: winlayout.hxx:45
virtual bool operator()(GenericSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC, bool bRenderingModeNatural)=0
const vcl::font::PhysicalFontFace * GetFontFace() const
hb_font_t * ImplInitHbFont() override
float GetScale() const
Definition: winlayout.hxx:46