Verovio
Source code documentation
syl.h
1 // Name: syl.h
3 // Author: Laurent Pugin
4 // Created: 2014
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_SYL_H__
9 #define __VRV_SYL_H__
10 
11 #include "atts_shared.h"
12 #include "facsimileinterface.h"
13 #include "layerelement.h"
14 #include "offsetinterface.h"
15 #include "timeinterface.h"
16 
17 namespace vrv {
18 
19 class FontInfo;
20 class Note;
21 class TextElement;
22 
23 //----------------------------------------------------------------------------
24 // Syl
25 //----------------------------------------------------------------------------
26 
33 class Syl : public LayerElement,
34  public TextListInterface,
35  public OffsetInterface,
36  public TimeSpanningInterface,
37  public AttLang,
38  public AttTypography,
39  public AttSylLog {
40 public:
46  Syl();
47  virtual ~Syl();
48  Object *Clone() const override { return new Syl(*this); }
49  void Reset() override;
50  std::string GetClassName() const override { return "syl"; }
52 
54  bool IsRelativeToStaff() const override { return true; }
55 
60  OffsetInterface *GetOffsetInterface() override { return vrv_cast<OffsetInterface *>(this); }
61  const OffsetInterface *GetOffsetInterface() const override { return vrv_cast<const OffsetInterface *>(this); }
62  TimePointInterface *GetTimePointInterface() override { return vrv_cast<TimePointInterface *>(this); }
63  const TimePointInterface *GetTimePointInterface() const override
64  {
65  return vrv_cast<const TimePointInterface *>(this);
66  }
67  TimeSpanningInterface *GetTimeSpanningInterface() override { return vrv_cast<TimeSpanningInterface *>(this); }
68  const TimeSpanningInterface *GetTimeSpanningInterface() const override
69  {
70  return vrv_cast<const TimeSpanningInterface *>(this);
71  }
73 
78  bool IsSupportedChild(ClassId classId) override;
79 
83  int CalcHyphenLength(Doc *doc, int staffSize);
84 
86  FontInfo GetDrawingFont(Doc *doc, int staffSize) const;
87 
91  int CalcConnectorSpacing(Doc *doc, int staffSize);
92 
93  int GetDrawingWidth() const;
94  int GetDrawingHeight() const;
95 
97  void SetDrawingTextInkBounds(int top, int bottom)
98  {
99  m_drawingTextInkTop = top;
100  m_drawingTextInkBottom = bottom;
101  m_hasDrawingTextInkBounds = true;
102  }
103  void ResetDrawingTextInkBounds() { m_hasDrawingTextInkBounds = false; }
104  bool HasDrawingTextInkBounds() const { return m_hasDrawingTextInkBounds; }
105  int GetDrawingTextInkTop() const { return m_drawingTextInkTop; }
106  int GetDrawingTextInkBottom() const { return m_drawingTextInkBottom; }
107 
111  bool IsEmpty() const;
112 
113  //----------------//
114  // Static methods //
115  //----------------//
116 
120  static void AdjustToLyricSize(const Doc *doc, int &value);
121 
122  //----------//
123  // Functors //
124  //----------//
125 
130  FunctorCode Accept(Functor &functor) override;
131  FunctorCode Accept(ConstFunctor &functor) const override;
132  FunctorCode AcceptEnd(Functor &functor) override;
133  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
135 
136 private:
137  //
138 public:
147  data_STAFFREL m_drawingVersePlace;
148 
154 
155 private:
156  int m_drawingTextInkTop;
157  int m_drawingTextInkBottom;
158  bool m_hasDrawingTextInkBounds;
159 };
160 
161 } // namespace vrv
162 
163 #endif
This abstract class is the base class for all const functors.
Definition: functor.h:126
This class is a hold the data and corresponds to the model of a MVC design pattern.
Definition: doc.h:41
This class is store font properties.
Definition: devicecontextbase.h:137
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
This class is a base class for the Layer (<layer>) content.
Definition: layerelement.h:51
This class represents a basic object.
Definition: object.h:66
This class is an interface for elements having a single visual offset, such as arpeg,...
Definition: offsetinterface.h:28
Syl is a TimeSpanningInterface for managing syllable connectors.
Definition: syl.h:39
static void AdjustToLyricSize(const Doc *doc, int &value)
Adjust proportionally to the lyric size.
void Reset() override
Virtual reset method.
bool IsSupportedChild(ClassId classId) override
Add an element (text, rend.
Syl * m_nextWordSyl
A pointer to the next syllable of the word.
Definition: syl.h:153
Object * Clone() const override
Method call for copying child classes.
Definition: syl.h:48
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
bool IsEmpty() const
Return true when the syl has no textual content.
bool IsRelativeToStaff() const override
Override the method since it is align to the staff.
Definition: syl.h:54
int CalcConnectorSpacing(Doc *doc, int staffSize)
Calculate the spacing needed depending on the @worpos and @con.
data_STAFFREL m_drawingVersePlace
The verse place (below by default)
Definition: syl.h:147
int m_drawingVoltaN
The normalized volta row within the verse (one by default).
Definition: syl.h:145
int CalcHyphenLength(Doc *doc, int staffSize)
Calculate the hyphen length using the text font.
void SetDrawingTextInkBounds(int top, int bottom)
Store and retrieve the actual glyph-ink bounds calculated while drawing the syllable text.
Definition: syl.h:97
FontInfo GetDrawingFont(Doc *doc, int staffSize) const
Return the effective font used for the syllable and its connector.
int m_drawingVerseN
The verse number with multiple verses Value is 1 by default, set in PrepareLyrics.
Definition: syl.h:143
This class is an pseudo interface for elements maintaining a flat list of children LayerElement for p...
Definition: object.h:1036
This class is an interface for spanning elements, such as slur, hairpin, etc.
Definition: timeinterface.h:145