vsg: include/vsg/text/TextLayout.h Source File

vsg 1.1.10 VulkanSceneGraph library |

Loading...
Searching...
No Matches
TextLayout.h
1#pragma once
2
3/* <editor-fold desc="MIT License">
4
5Copyright(c) 2020 Robert Osfield
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
9The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
13</editor-fold> */
14
15#include <vsg/core/Data.h>
16#include <vsg/maths/box.h>
17#include <vsg/text/Font.h>
18
19namespace vsg
20{
21 struct TextQuad
22 {
23 vec3 vertices[4];
24 vec2 texcoords[4];
25 vec4 colors[4];
26 vec4 outlineColors[4];
27 float outlineWidths[4];
28 vec3 normal;
29 vec4 centerAndAutoScaleDistance; // only used when billboarding
30 };
31
32 using TextQuads = std::vector<TextQuad>;
33
34 class VSG_DECLSPEC TextLayout : public Inherit<Object, TextLayout>
35 {
36 public:
37 virtual bool requiresBillboard() const { return false; }
38 virtual void layout(const Data* text, const Font& font, TextQuads& texQuads) = 0;
39 virtual vec2 alignment(const Data* text, const Font& font) const = 0;
40 virtual dbox extents(const Data* text, const Font& font) const = 0;
41 };
42 VSG_type_name(vsg::TextLayout);
43
44} // namespace vsg
vsg::Data
Definition Data.h:110
vsg::Font
Definition Font.h:24
vsg::TextLayout
Definition TextLayout.h:35
vsg::TextQuad
Definition TextLayout.h:22