summaryrefslogtreecommitdiff
path: root/src/gmdocument.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r--src/gmdocument.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 6fde864a..eb147925 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -133,15 +133,6 @@ static void clearLinks_GmDocument_(iGmDocument *d) {
133} 133}
134 134
135static void doLayout_GmDocument_(iGmDocument *d) { 135static void doLayout_GmDocument_(iGmDocument *d) {
136 clear_Array(&d->layout);
137 clearLinks_GmDocument_(d);
138 if (d->size.x <= 0 || isEmpty_String(&d->source)) {
139 return;
140 }
141 iBool isPreformat = iFalse;
142 iInt2 pos = zero_I2();
143 const iRangecc content = range_String(&d->source);
144 iRangecc line = iNullRange;
145 /* TODO: Collect these parameters into a GmTheme. */ 136 /* TODO: Collect these parameters into a GmTheme. */
146 static const int fonts[max_GmLineType] = { 137 static const int fonts[max_GmLineType] = {
147 paragraph_FontId, 138 paragraph_FontId,
@@ -152,17 +143,17 @@ static void doLayout_GmDocument_(iGmDocument *d) {
152 header2_FontId, 143 header2_FontId,
153 header3_FontId, 144 header3_FontId,
154 regular_FontId, 145 regular_FontId,
155 }; 146 };
156 static const int colors[max_GmLineType] = { 147 static const int colors[max_GmLineType] = {
157 gray75_ColorId, 148 gray75_ColorId,
158 gray75_ColorId, 149 gray75_ColorId,
159 orange_ColorId, 150 cyan_ColorId,
160 orange_ColorId, 151 gray75_ColorId,
161 white_ColorId, 152 white_ColorId,
162 white_ColorId, 153 white_ColorId,
163 white_ColorId, 154 white_ColorId,
164 white_ColorId, 155 white_ColorId,
165 }; 156 };
166 static const int indents[max_GmLineType] = { 157 static const int indents[max_GmLineType] = {
167 4, 10, 4, 10, 0, 0, 0, 0 158 4, 10, 4, 10, 0, 0, 0, 0
168 }; 159 };
@@ -173,10 +164,19 @@ static void doLayout_GmDocument_(iGmDocument *d) {
173 0.0f, 0.5f, 1.0f, 0.5f, 1.0f, 1.0f, 1.0f, 1.0f 164 0.0f, 0.5f, 1.0f, 0.5f, 1.0f, 1.0f, 1.0f, 1.0f
174 }; 165 };
175 static const char *bullet = "\u2022"; 166 static const char *bullet = "\u2022";
176 iRangecc preAltText = iNullRange; 167 clear_Array(&d->layout);
177 enum iGmLineType prevType = text_GmLineType; 168 clearLinks_GmDocument_(d);
178 iBool isFirstText = iTrue; 169 if (d->size.x <= 0 || isEmpty_String(&d->source)) {
179 int preFont = preformatted_FontId; 170 return;
171 }
172 const iRangecc content = range_String(&d->source);
173 iInt2 pos = zero_I2();
174 iRangecc line = iNullRange;
175 iRangecc preAltText = iNullRange;
176 enum iGmLineType prevType = text_GmLineType;
177 iBool isPreformat = iFalse;
178 iBool isFirstText = iTrue;
179 int preFont = preformatted_FontId;
180 while (nextSplit_Rangecc(&content, "\n", &line)) { 180 while (nextSplit_Rangecc(&content, "\n", &line)) {
181 iGmRun run; 181 iGmRun run;
182 run.color = white_ColorId; 182 run.color = white_ColorId;