Ocean
Loading...
Searching...
No Matches
FontStyle.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_SCENEDESCRIPTION_SDX_X3D_FONT_STYLE_H
9#define META_OCEAN_SCENEDESCRIPTION_SDX_X3D_FONT_STYLE_H
10
13
15
16namespace Ocean
17{
18
19namespace SceneDescription
20{
21
22namespace SDX
23{
24
25namespace X3D
26{
27
28/**
29 * This class implements an abstract x3d font style.
30 * @ingroup scenedescriptionsdxx3d
31 */
32class OCEAN_SCENEDESCRIPTION_SDX_X3D_EXPORT FontStyle : virtual public X3DFontStyleNode
33{
34 friend class Text;
35
36 public:
37
38 /**
39 * Creates an abstract x3d sensor node.
40 * @param environment Node environment
41 */
42 explicit FontStyle(const SDXEnvironment* environment);
43
44 protected:
45
46 /**
47 * Specifies the node type and the fields of this node.
48 * @return Unique node specification of this node
49 */
51
52 /**
53 * Event function to inform the node that it has been initialized and can apply all internal values to corresponding rendering objects.
54 * @see SDXNode::onInitialize().
55 */
56 void onInitialize(const Rendering::SceneRef& scene, const Timestamp timestamp) override;
57
58 /**
59 * Returns the address of the most derived object.
60 * @see Node::objectAddress().
61 */
62 size_t objectAddress() const override;
63
64 /**
65 * Applies all properties to a given text object.
66 * @param text The text to which all properties will be applied
67 */
68 void applyToText(Rendering::Text& text) const;
69
70 /**
71 * Applies the font property to a given text object.
72 * @param text The text to which all properties will be applied
73 * @param fontFamilyNames Several names of font families, the first existing will be applied, empty to use the default font
74 * @param fontStyleName The optional name of the font style, empty to use the default style
75 * @return True, if succeeded
76 */
77 static bool applyFontToText(Rendering::Text& text, const std::vector<std::string>& fontFamilyNames = std::vector<std::string>(), const std::string& fontStyleName = std::string());
78
79 protected:
80
81 /// Family field.
83
84 /// horizontal field.
86
87 /// Justify field.
89
90 /// Language field.
92
93 /// LeftToRight field.
95
96 /// Size field.
98
99 /// Spacing field.
101
102 /// Style field.
104
105 /// TopToBottom field.
107};
108
109}
110
111}
112
113}
114
115}
116
117#endif // META_OCEAN_SCENEDESCRIPTION_SDX_X3D_FONT_STYLE_H
This class is the base class for all texts.
Definition rendering/Text.h:39
This class implements a node specification object.
Definition scenedescription/Node.h:77
This class implements an abstract x3d font style.
Definition FontStyle.h:33
size_t objectAddress() const override
Returns the address of the most derived object.
MultiString justify_
Justify field.
Definition FontStyle.h:88
SingleFloat spacing_
Spacing field.
Definition FontStyle.h:100
MultiString family_
Family field.
Definition FontStyle.h:82
SingleBool topToBottom_
TopToBottom field.
Definition FontStyle.h:106
SingleFloat size_
Size field.
Definition FontStyle.h:97
void onInitialize(const Rendering::SceneRef &scene, const Timestamp timestamp) override
Event function to inform the node that it has been initialized and can apply all internal values to c...
NodeSpecification specifyNode()
Specifies the node type and the fields of this node.
void applyToText(Rendering::Text &text) const
Applies all properties to a given text object.
SingleString style_
Style field.
Definition FontStyle.h:103
FontStyle(const SDXEnvironment *environment)
Creates an abstract x3d sensor node.
SingleString language_
Language field.
Definition FontStyle.h:91
SingleBool horizontal_
horizontal field.
Definition FontStyle.h:85
SingleBool leftToRight_
LeftToRight field.
Definition FontStyle.h:94
static bool applyFontToText(Rendering::Text &text, const std::vector< std::string > &fontFamilyNames=std::vector< std::string >(), const std::string &fontStyleName=std::string())
Applies the font property to a given text object.
This class implements a x3d text node.
Definition scenedescription/sdx/x3d/Text.h:33
This class implements an abstract x3d font style node.
Definition X3DFontStyleNode.h:31
This class implements a node environment container.
Definition SDXNode.h:62
This class implements a timestamp.
Definition Timestamp.h:36
The namespace covering the entire Ocean framework.
Definition Accessor.h:15