denigma 4.0.0
Loading...
Searching...
No Matches
general_lines.h
1/*
2 * Copyright (C) 2026, Robert Patterson
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22#pragma once
23
24#include <memory>
25#include <optional>
26#include <string>
27
28#include "musx/musx.h"
29
30namespace denigma {
31namespace classify {
32
33namespace smartshape {
34
37struct LineCap
38{
41 enum class Type
42 {
43 None,
44 Hook,
47 };
48
50 musx::dom::Efix hookLength{};
54 std::optional<musx::dom::ArrowheadPreset> preset;
55 musx::dom::MusxInstance<musx::dom::others::ShapeDef> customArrowhead;
56 musx::dom::KnownShapeDefType customArrowheadType{ musx::dom::KnownShapeDefType::Unrecognized };
57};
58
66{
68 using LineStyle = musx::dom::others::SmartShapeCustomLine::LineStyle;
69
71 bool lineVisible{};
72 musx::dom::Efix lineWidth{};
73 musx::dom::Efix dashOn{};
74 musx::dom::Efix dashOff{};
75 char32_t lineChar{};
76 std::shared_ptr<musx::dom::FontInfo> lineCharFont;
77 std::optional<std::string> lineCharGlyphName;
78 bool horizontal{};
82
83 musx::util::EnigmaParsingContext startText;
84 musx::util::EnigmaParsingContext continuationText;
85 musx::util::EnigmaParsingContext endText;
86 musx::util::EnigmaParsingContext centerFullText;
87 musx::util::EnigmaParsingContext centerAbbrText;
88
91 musx::dom::MusxInstance<musx::dom::others::SmartShapeCustomLine> customLine;
92};
93
94} // namespace smartshape
95
98[[nodiscard]]
99std::optional<smartshape::GeneralLine> classifyGeneralLine(
100 const musx::dom::MusxInstance<musx::dom::others::SmartShapeCustomLine>& customLine);
101
108[[nodiscard]]
109std::optional<smartshape::GeneralLine> classifyGeneralLine(
110 const musx::dom::MusxInstance<musx::dom::others::SmartShape>& shape);
111
112} // namespace classify
113} // namespace denigma
std::optional< smartshape::GeneralLine > classifyGeneralLine(const musx::dom::MusxInstance< musx::dom::others::SmartShapeCustomLine > &customLine)
Describes a custom line style as a smartshape::GeneralLine.
Core public API for the Denigma conversion libraries.
Definition articulations.h:32
Describes the appearance of a line-type smart shape in musxdom terms.
Definition general_lines.h:66
musx::util::EnigmaParsingContext startText
Left-start text, if any. (Custom lines only.)
Definition general_lines.h:83
musx::util::EnigmaParsingContext continuationText
Left-continuation text, if any. (Custom lines only.)
Definition general_lines.h:84
musx::dom::Efix dashOn
Dash length. (Dashed style only.)
Definition general_lines.h:73
LineStyle lineStyle
Line body style.
Definition general_lines.h:70
musx::dom::Efix dashOff
Length of gap between dashes. (Dashed style only.)
Definition general_lines.h:74
LineCap endCap
Cap at the right/end end.
Definition general_lines.h:81
musx::dom::others::SmartShapeCustomLine::LineStyle LineStyle
The line body style. (Custom lines and built-ins share the musxdom custom-line enum....
Definition general_lines.h:68
musx::util::EnigmaParsingContext centerAbbrText
Center abbreviated text, if any. (Custom lines only.)
Definition general_lines.h:87
musx::util::EnigmaParsingContext endText
Right-end text, if any. (Custom lines only.)
Definition general_lines.h:85
musx::util::EnigmaParsingContext centerFullText
Center full text, if any. (Custom lines only.)
Definition general_lines.h:86
bool horizontal
True when the line is forced horizontal ("Horizontal" in the custom line dialog).
Definition general_lines.h:78
std::optional< std::string > lineCharGlyphName
SMuFL glyph name of lineChar, when resolvable. (Char style only.)
Definition general_lines.h:77
bool lineVisible
False when the line body draws nothing (zero width or a blank character).
Definition general_lines.h:71
musx::dom::Efix lineWidth
Line width. (Solid and dashed styles.)
Definition general_lines.h:72
char32_t lineChar
The repeated line character. (Char style only.)
Definition general_lines.h:75
musx::dom::MusxInstance< musx::dom::others::SmartShapeCustomLine > customLine
The custom line style, or null when the shape is a built-in line type.
Definition general_lines.h:91
LineCap startCap
Cap at the left/start end.
Definition general_lines.h:80
std::shared_ptr< musx::dom::FontInfo > lineCharFont
The font of lineChar. (Char style only.)
Definition general_lines.h:76
Describes the cap (hook or arrowhead) at one end of a line-type smart shape.
Definition general_lines.h:38
Type
The kind of cap at this end of the line.
Definition general_lines.h:42
@ ArrowheadPreset
One of Finale's preset arrowheads. (See preset.)
@ ArrowheadCustom
A Shape Designer arrowhead. (See customArrowhead and customArrowheadType.)
@ Hook
A perpendicular hook. (See hookLength.)
musx::dom::KnownShapeDefType customArrowheadType
Recognized type of customArrowhead. (Only for Type::ArrowheadCustom.)
Definition general_lines.h:56
std::optional< musx::dom::ArrowheadPreset > preset
The preset arrowhead, when the preset id is valid. (Only for Type::ArrowheadPreset....
Definition general_lines.h:54
musx::dom::Efix hookLength
Signed hook length: positive extends up.
Definition general_lines.h:50
musx::dom::MusxInstance< musx::dom::others::ShapeDef > customArrowhead
The arrowhead shape, when resolvable. (Only for Type::ArrowheadCustom.)
Definition general_lines.h:55
Type type
The cap type.
Definition general_lines.h:49