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>
30
31// win32 specific logical font instance
33{
35
36public:
37 ~WinFontInstance() override;
38
39 bool hasHScale() const;
40 float getHScale() const;
41
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
56
57 IDWriteFontFace* GetDWFontFace() const;
58
59private:
61
62 virtual void ImplInitHbFont(hb_font_t*) override;
64
66 HFONT m_hFont;
67 float m_fScale;
69 sal_Int32 m_nTmDescent;
70 mutable sal::systools::COMReference<IDWriteFontFace> mxDWFontFace;
71};
72
74{
75protected:
76 explicit TextOutRenderer() = default;
79
80public:
81 static TextOutRenderer & get(bool bUseDWrite, bool bRenderingModeNatural);
82
83 virtual ~TextOutRenderer() = default;
84
85 virtual bool operator ()(GenericSalLayout const &rLayout,
86 SalGraphics &rGraphics,
87 HDC hDC,
88 bool bRenderingModeNatural) = 0;
89};
90
92{
95
96public:
97 explicit ExTextOutRenderer() = default;
98
99 bool operator ()(GenericSalLayout const &rLayout,
100 SalGraphics &rGraphics,
101 HDC hDC,
102 bool bRenderingModeNatural) override;
103};
104
105/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ExTextOutRenderer & operator=(const ExTextOutRenderer &)=delete
ExTextOutRenderer()=default
ExTextOutRenderer(const ExTextOutRenderer &)=delete
bool operator()(GenericSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC, bool bRenderingModeNatural) override
const vcl::font::PhysicalFontFace * GetFontFace() const
virtual bool operator()(GenericSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC, bool bRenderingModeNatural)=0
static TextOutRenderer & get(bool bUseDWrite, bool bRenderingModeNatural)
virtual ~TextOutRenderer()=default
TextOutRenderer & operator=(const TextOutRenderer &)=delete
TextOutRenderer(const TextOutRenderer &)=delete
TextOutRenderer()=default
rtl::Reference< LogicalFontInstance > CreateFontInstance(const vcl::font::FontSelectPattern &) const override
bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon &, bool) const override
~WinFontInstance() override
HFONT GetHFONT() const
Definition: winlayout.hxx:45
float getHScale() const
sal::systools::COMReference< IDWriteFontFace > mxDWFontFace
Definition: winlayout.hxx:70
float GetScale() const
Definition: winlayout.hxx:46
bool IsCJKVerticalFont() const
Definition: winlayout.hxx:49
bool m_bIsCJKVerticalFont
Definition: winlayout.hxx:68
void SetGraphics(WinSalGraphics *)
sal_Int32 m_nTmDescent
Definition: winlayout.hxx:69
const WinFontFace * GetFontFace() const
Definition: winlayout.hxx:52
bool hasHScale() const
sal_Int32 GetTmDescent() const
Definition: winlayout.hxx:50
WinFontFace * GetFontFace()
Definition: winlayout.hxx:53
WinSalGraphics * m_pGraphics
Definition: winlayout.hxx:65
IDWriteFontFace * GetDWFontFace() const
bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle &, bool) const override
WinSalGraphics * GetGraphics() const
Definition: winlayout.hxx:43
virtual void ImplInitHbFont(hb_font_t *) override
WinFontInstance(const WinFontFace &, const vcl::font::FontSelectPattern &)
WinSalGraphics never owns the HDC it uses to draw, because the HDC can have various origins with diff...
Definition: win/salgdi.h:141
uint32_t sal_GlyphId
Definition: glyphid.hxx:24