Debian Codegraph @

fontforgeexe/wordlistparser.h

raw symbols SCIP
1 /******************************************************************************
2 *******************************************************************************
3 *******************************************************************************
4
5 Copyright (C) 2013 Ben Martin
6
7 This file is part of FontForge.
8
9 FontForge 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 FontForge 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 FontForge. If not, see <http://www.gnu.org/licenses/>.
21
22 For more details see the COPYING.gplv3 file in the root directory of this
23 distribution.
24
25 *******************************************************************************
26 *******************************************************************************
27 ******************************************************************************/
28
29 #ifndef FONTFORGE_WORDLISTPARSER_H
30 #define FONTFORGE_WORDLISTPARSER_H
31
32 #include "ffglib.h"
33 #include "splinefont.h"
34
35 const char* Wordlist_getSCName( SplineChar* sc );
36
37 typedef int (*WordlistEscapedInputStringToRealString_getFakeUnicodeOfScFunc)( SplineChar *sc, void* udata );
38 extern int WordlistEscapedInputStringToRealString_getFakeUnicodeAsScUnicodeEnc( SplineChar *sc, void* udata );
39
40
41 extern unichar_t* WordlistEscapedInputStringToRealStringBasic(
42 SplineFont* sf,
43 unichar_t* input_const,
44 GArray** selected_out );
45
46 extern GTextInfo** WordlistLoadFileToGTextInfo( int type, int words_max );
47 extern GTextInfo** WordlistLoadFileToGTextInfoBasic( int words_max );
48
49 extern void Wordlist_MoveByOffset( GGadget* g, int* idx, int offset );
50 extern void Wordlist_touch( GGadget* g );
51
52 extern void WordlistLoadToGTextInfo( GGadget* g, int* idx );
53
54 extern void WordlistTrimTrailingSingleSlash( unichar_t* txt );
55
56 extern unichar_t* Wordlist_selectionClear( SplineFont* sf, EncMap *map, unichar_t* txtu );
57 extern unichar_t* Wordlist_selectionAdd( SplineFont* sf, EncMap *map, unichar_t* txtu, int offset );
58
59
60 extern unichar_t* Wordlist_advanceSelectedCharsBy( SplineFont* sf, EncMap *map, unichar_t* txtu, int offset );
61
62
63 /**
64 * This is the array of characters that are referenced from a
65 * wordlistline. I'd felt that such a setup was much better than the
66 * previous string wrangling, and with fonts that have splinechars
67 * that have no unicode value, it makes more sense to explicitly
68 * address the string this way.
69 *
70 * for example,
71 * ab/comma/slash will have 4 elements in the array and a null sc as element this[4].
72 * this[0].sc = 'a'
73 * this[1].sc = 'b'
74 * this[2].sc = ','
75 * this[3].sc = '/'
76 * this[4].sc = \0
77 *
78 * currentGlyphIndex is a hang over from old code, still might be handy if you have a pointer
79 * to a single WordListChar element and you want to know what splinechar it is in the string.
80 * Selections are now handled using isSelected in each element.
81 */
82 typedef struct wordlistchar {
83 SplineChar* sc;
84 int isSelected;
85 int currentGlyphIndex;
86 int n;
87 } WordListChar;
88
89 typedef WordListChar* WordListLine;
90
91 extern bool Wordlist_selectionsEqual( unichar_t* s1, unichar_t* s2 );
92 extern WordListLine WordListLine_end( WordListLine wll );
93 extern int WordListLine_size( WordListLine wll );
94 extern unichar_t* WordListLine_toustr( WordListLine wll );
95
96 /**
97 * Parse the string input_const into a WordListLine of WordListChar
98 * structures for each character in input_const. A structure such as
99 * WordListChar is used to describe each character so that you can
100 * quickly tell if it should be "selected" in the user interface and
101 * what the character index is.
102 *
103 * The input_const string can be complex, including selectors for
104 * glyphs so that many unichar_t are consumed to select a single
105 * splinechar. So the currentGlyphIndex allows you to see which
106 * SplineChar from 0 upwards the current WordListChar is.
107 *
108 * NOTE that this function (and
109 * WordlistEscapedInputStringToParsedDataComplex) may create
110 * splinechar instances in the splinefont that you pass in. So the
111 * function may not be free of side effects.
112 */
113 extern WordListLine WordlistEscapedInputStringToParsedData( SplineFont* sf,
114 unichar_t* input_const );
115 extern WordListLine WordlistEscapedInputStringToParsedDataComplex(
116 SplineFont* sf,
117 const unichar_t* input_const,
118 WordlistEscapedInputStringToRealString_getFakeUnicodeOfScFunc getUnicodeFunc,
119 void* udata );
120
121 #endif /* FONTFORGE_WORDLISTPARSER_H */