Debian Codegraph @

texk/gregorio/gregorio-src/src/characters.h

raw
1 /*
2 * Gregorio is a program that translates gabc files to GregorioTeX
3 * This header prototypes the lyric handling data structures and entry points.
4 *
5 * Copyright (C) 2008-2025 The Gregorio Project (see CONTRIBUTORS.md)
6 *
7 * This file is part of Gregorio.
8 *
9 * Gregorio is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * Gregorio is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with Gregorio. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23 #ifndef CHARACTERS_H
24 #define CHARACTERS_H
25
26 #include "bool.h"
27 #include "struct.h"
28
29 /*
30 *
31 * The three next defines are the possible values of center_is_determined.
32 *
33 * CENTER_NOT_DETERMINED means that the plugin has encountered no { nor } (in
34 * the gabc syntax). CENTER_HALF_DETERMINED means that the plugin has
35 * encountered a { but no }, and we will try to determine a middle starting
36 * after the {. CENTER_FULLY_DETERMINED means that lex has encountered a { and
37 * a }, so we won't determine the middle, it is considered done.
38 * CENTER_DETERMINING_MIDDLE is used internally in the big function to know
39 * where we are in the middle determination.
40 *
41 */
42
43 typedef enum gregorio_center_determination {
44 CENTER_NOT_DETERMINED = 0,
45 CENTER_HALF_DETERMINED,
46 CENTER_FULLY_DETERMINED,
47 CENTER_DETERMINING_MIDDLE
48 } gregorio_center_determination;
49
50 /* this is a temporary structure that will be used for style determination */
51
52 typedef struct det_style {
53 grestyle_style style;
54 struct det_style *previous_style;
55 struct det_style *next_style;
56 } det_style;
57
58 typedef enum gregorio_write_text_phase {
59 WTP_NORMAL,
60 WTP_FIRST_SYLLABLE
61 } gregorio_write_text_phase;
62
63 void gregorio_write_text(gregorio_write_text_phase phase,
64 const gregorio_character *current_character, FILE *f,
65 void (*printverb) (FILE *, const grewchar *),
66 void (*printchar) (FILE *, grewchar),
67 void (*begin) (FILE *, grestyle_style),
68 void (*end) (FILE *, grestyle_style),
69 void (*printspchar) (FILE *, const grewchar *));
70
71 void gregorio_write_first_letter_alignment_text(gregorio_write_text_phase phase,
72 const gregorio_character *current_character, FILE *f,
73 void (*printverb) (FILE *, const grewchar *),
74 void (*printchar) (FILE *, grewchar),
75 void (*begin) (FILE *, grestyle_style),
76 void (*end) (FILE *, grestyle_style),
77 void (*printspchar) (FILE *, const grewchar *));
78
79 void gregorio_set_centering_language(char *language);
80
81 void gregorio_rebuild_characters(gregorio_character **param_character,
82 gregorio_center_determination center_is_determined, bool skip_initial);
83
84 void gregorio_rebuild_first_syllable(gregorio_character **param_character,
85 bool separate_initial);
86
87 void gregorio_set_first_word(gregorio_character **character);
88
89 #endif