summaryrefslogtreecommitdiff
path: root/src/gmdocument.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r--src/gmdocument.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index f8d41172..56953255 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -31,6 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31#include "visited.h" 31#include "visited.h"
32#include "bookmarks.h" 32#include "bookmarks.h"
33#include "app.h" 33#include "app.h"
34#include "defs.h"
34 35
35#include <the_Foundation/ptrarray.h> 36#include <the_Foundation/ptrarray.h>
36#include <the_Foundation/regexp.h> 37#include <the_Foundation/regexp.h>
@@ -329,14 +330,15 @@ static void alignDecoration_GmRun_(iGmRun *run, iBool isCentered) {
329 int xAdjust = 0; 330 int xAdjust = 0;
330 if (!isCentered) { 331 if (!isCentered) {
331 /* Keep the icon aligned to the left edge. */ 332 /* Keep the icon aligned to the left edge. */
333 const int alignWidth = width_Rect(run->visBounds) * 3 / 4;
332 xAdjust -= left_Rect(visBounds); 334 xAdjust -= left_Rect(visBounds);
333 if (visWidth > width_Rect(run->visBounds)) { 335 if (visWidth > alignWidth) {
334 /* ...unless it's a wide icon, in which case move it to the left. */ 336 /* ...unless it's a wide icon, in which case move it to the left. */
335 xAdjust -= visWidth - width_Rect(run->visBounds); 337 xAdjust -= visWidth - alignWidth;
336 } 338 }
337 else if (visWidth < width_Rect(run->visBounds) * 3 / 4) { 339 else if (visWidth < alignWidth) {
338 /* ...or a narrow icon, which needs to be centered but leave a gap. */ 340 /* ...or a narrow icon, which needs to be centered but leave a gap. */
339 xAdjust += (width_Rect(run->visBounds) * 3 / 4 - visWidth) / 2; 341 xAdjust += (alignWidth - visWidth) / 2;
340 } 342 }
341 } 343 }
342 else { 344 else {
@@ -401,7 +403,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
401 static const float bottomMargin[max_GmLineType] = { 403 static const float bottomMargin[max_GmLineType] = {
402 0.0f, 0.333f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f, 0.25f 404 0.0f, 0.333f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f, 0.25f
403 }; 405 };
404 static const char *arrow = "\u27a4"; 406 static const char *arrow = rightArrowhead_Icon;
405 static const char *envelope = "\U0001f4e7"; 407 static const char *envelope = "\U0001f4e7";
406 static const char *bullet = "\u2022"; 408 static const char *bullet = "\u2022";
407 static const char *folder = "\U0001f4c1"; 409 static const char *folder = "\U0001f4c1";
@@ -618,7 +620,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
618 iGmRun bulRun = run; 620 iGmRun bulRun = run;
619 if (prefs->font == literata_TextFont) { 621 if (prefs->font == literata_TextFont) {
620 /* Something wrong this the glyph in Literata, looks cropped. */ 622 /* Something wrong this the glyph in Literata, looks cropped. */
621 bulRun.font = defaultContentSized_FontId; 623 bulRun.font = defaultContentRegular_FontId;
622 } 624 }
623 bulRun.color = tmQuote_ColorId; 625 bulRun.color = tmQuote_ColorId;
624 bulRun.visBounds.pos = addX_I2(pos, (indents[text_GmLineType] - 0.55f) * gap_Text); 626 bulRun.visBounds.pos = addX_I2(pos, (indents[text_GmLineType] - 0.55f) * gap_Text);
@@ -724,7 +726,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
724 lineHeightReduction = 0.10f; 726 lineHeightReduction = 0.10f;
725 } 727 }
726 else if (type == heading2_GmLineType) { 728 else if (type == heading2_GmLineType) {
727 lineHeightReduction = 0.05f; 729 lineHeightReduction = 0.06f;
728 } 730 }
729 /* Visited links are never bold. */ 731 /* Visited links are never bold. */
730 if (run.linkId && linkFlags_GmDocument(d, run.linkId) & visited_GmLinkFlag) { 732 if (run.linkId && linkFlags_GmDocument(d, run.linkId) & visited_GmLinkFlag) {
@@ -1517,6 +1519,7 @@ static void normalize_GmDocument(iGmDocument *d) {
1517 printf("wasNormalized: %d\n", wasNormalized); 1519 printf("wasNormalized: %d\n", wasNormalized);
1518 fflush(stdout); 1520 fflush(stdout);
1519 set_String(&d->source, collect_String(normalized)); 1521 set_String(&d->source, collect_String(normalized));
1522 normalize_String(&d->source); /* NFC */
1520 printf("orig:%zu norm:%zu\n", size_String(&d->unormSource), size_String(&d->source)); 1523 printf("orig:%zu norm:%zu\n", size_String(&d->unormSource), size_String(&d->source));
1521 /* normalized source has an extra newline at the end */ 1524 /* normalized source has an extra newline at the end */
1522// iAssert(wasNormalized || equal_String(&d->unormSource, &d->source)); 1525// iAssert(wasNormalized || equal_String(&d->unormSource, &d->source));