summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gmdocument.c25
-rw-r--r--src/ui/color.h1
-rw-r--r--src/ui/text.h10
3 files changed, 24 insertions, 12 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 54b7ad56..660b05fd 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -469,10 +469,6 @@ static void doLayout_GmDocument_(iGmDocument *d) {
469 if (!isPreformat || (prevType != preformatted_GmLineType)) { 469 if (!isPreformat || (prevType != preformatted_GmLineType)) {
470 int required = 470 int required =
471 iMax(topMargin[type], bottomMargin[prevType]) * lineHeight_Text(paragraph_FontId); 471 iMax(topMargin[type], bottomMargin[prevType]) * lineHeight_Text(paragraph_FontId);
472 if (type == link_GmLineType && prevType == link_GmLineType) {
473 /* Reduced margin between consecutive links. */
474 required *= 0.75f;
475 }
476 if (type == quote_GmLineType && prevType == quote_GmLineType) { 472 if (type == quote_GmLineType && prevType == quote_GmLineType) {
477 /* No margin between consecutive quote lines. */ 473 /* No margin between consecutive quote lines. */
478 required = 0; 474 required = 0;
@@ -541,8 +537,19 @@ static void doLayout_GmDocument_(iGmDocument *d) {
541 icon.text = link->labelIcon; 537 icon.text = link->labelIcon;
542 } 538 }
543 icon.font = regular_FontId; 539 icon.font = regular_FontId;
544 if (link->flags & remote_GmLinkFlag) { 540 /* Center the icon within the indentation. */ {
545 icon.visBounds.pos.x -= gap_Text / 2; 541 const iRect visBounds = visualBounds_Text(icon.font, icon.text);
542 const int visWidth = width_Rect(visBounds);
543 /* Keep the icon aligned to the left edge. */
544 icon.visBounds.pos.x -= left_Rect(visBounds);
545 if (visWidth > width_Rect(icon.visBounds)) {
546 /* ...unless it's a wide icon, in which case move it to the left. */
547 icon.visBounds.pos.x -= visWidth - width_Rect(icon.visBounds);
548 }
549 else if (visWidth < width_Rect(icon.visBounds) * 3 / 4) {
550 /* ...or a narrow icon, which needs to be centered but leave a gap. */
551 icon.visBounds.pos.x += (width_Rect(icon.visBounds) * 3 / 4 - visWidth) / 2;
552 }
546 } 553 }
547 icon.color = linkColor_GmDocument(d, run.linkId, icon_GmLinkPart); 554 icon.color = linkColor_GmDocument(d, run.linkId, icon_GmLinkPart);
548 icon.flags |= decoration_GmRunFlag; 555 icon.flags |= decoration_GmRunFlag;
@@ -750,6 +757,8 @@ static void setDerivedThemeColors_(enum iGmDocumentTheme theme) {
750 addSatLum_HSLColor(get_HSLColor(tmParagraph_ColorId), 0.3f, -0.025f)); 757 addSatLum_HSLColor(get_HSLColor(tmParagraph_ColorId), 0.3f, -0.025f));
751 } 758 }
752 } 759 }
760 set_Color(tmLinkCustomIconVisited_ColorId,
761 mix_Color(get_Color(tmLinkIconVisited_ColorId), get_Color(tmLinkIcon_ColorId), 0.5f));
753#if 0 762#if 0
754 set_Color(tmOutlineHeadingAbove_ColorId, get_Color(white_ColorId)); 763 set_Color(tmOutlineHeadingAbove_ColorId, get_Color(white_ColorId));
755 set_Color(tmOutlineHeadingBelow_ColorId, get_Color(black_ColorId)); 764 set_Color(tmOutlineHeadingBelow_ColorId, get_Color(black_ColorId));
@@ -1471,8 +1480,8 @@ enum iColorId linkColor_GmDocument(const iGmDocument *d, iGmLinkId linkId, enum
1471 return tmBadLink_ColorId; 1480 return tmBadLink_ColorId;
1472 } 1481 }
1473 if (link->flags & iconFromLabel_GmLinkFlag) { 1482 if (link->flags & iconFromLabel_GmLinkFlag) {
1474 return link->flags & visited_GmLinkFlag ? tmLinkTextHover_ColorId 1483 return link->flags & visited_GmLinkFlag ? tmLinkCustomIconVisited_ColorId
1475 : tmLinkText_ColorId; 1484 : tmLinkIcon_ColorId;
1476 } 1485 }
1477 if (link->flags & visited_GmLinkFlag) { 1486 if (link->flags & visited_GmLinkFlag) {
1478 return link->flags & www_GmLinkFlag ? tmHypertextLinkIconVisited_ColorId 1487 return link->flags & www_GmLinkFlag ? tmHypertextLinkIconVisited_ColorId
diff --git a/src/ui/color.h b/src/ui/color.h
index 695e6302..a4a7b93e 100644
--- a/src/ui/color.h
+++ b/src/ui/color.h
@@ -115,6 +115,7 @@ enum iColorId {
115 uiTextAppTitle_ColorId, 115 uiTextAppTitle_ColorId,
116 uiBackgroundSidebar_ColorId, 116 uiBackgroundSidebar_ColorId,
117 uiBackgroundMenu_ColorId, 117 uiBackgroundMenu_ColorId,
118 tmLinkCustomIconVisited_ColorId,
118 119
119 /* content theme colors */ 120 /* content theme colors */
120 tmFirst_ColorId, 121 tmFirst_ColorId,
diff --git a/src/ui/text.h b/src/ui/text.h
index d57c2c62..8a023546 100644
--- a/src/ui/text.h
+++ b/src/ui/text.h
@@ -39,7 +39,7 @@ enum iFontId {
39 defaultLarge_FontId, 39 defaultLarge_FontId,
40 defaultLargeBold_FontId, 40 defaultLargeBold_FontId,
41 defaultMonospace_FontId, 41 defaultMonospace_FontId,
42 defaultContentSized_FontId, 42 defaultContentSized_FontId,
43 /* content fonts */ 43 /* content fonts */
44 regular_FontId, 44 regular_FontId,
45 monospace_FontId, 45 monospace_FontId,
@@ -138,14 +138,16 @@ iLocalDef iBool isDefaultIgnorable_Char(iChar c) {
138} 138}
139iLocalDef iBool isEmoji_Char(iChar c) { 139iLocalDef iBool isEmoji_Char(iChar c) {
140 return (c >= 0x1f300 && c < 0x1f700) || (c >= 0x1f7e0 && c <= 0x1f7eb) || 140 return (c >= 0x1f300 && c < 0x1f700) || (c >= 0x1f7e0 && c <= 0x1f7eb) ||
141 (c >= 0x1f900 && c <= 0x1f9ff); 141 (c >= 0x1f900 && c <= 0x1f9ff) || (c >= 0x1fa70 && c <= 0x1faff);
142} 142}
143iLocalDef iBool isDingbats_Char(iChar c) { 143iLocalDef iBool isDingbats_Char(iChar c) {
144 return c >= 0x2702 && c <= 0x27b0; 144 return c >= 0x2702 && c <= 0x27b0;
145} 145}
146iLocalDef iBool isSymbol_Char(iChar c) { 146iLocalDef iBool isSymbol_Char(iChar c) {
147 return (c == 0x2218 || c == 0x2219) || (c >= 0x1f680 && c <= 0x1f6c0) || 147 return (c == 0x21a9) ||
148 (c >= 0x2300 && c <= 0x26ff); 148 (c == 0x2218 || c == 0x2219) ||
149 (c >= 0x2300 && c <= 0x26ff) ||
150 (c >= 0x1f680 && c <= 0x1f6c0);
149} 151}
150 152
151#define emojiVariationSelector_Char ((iChar) 0xfe0f) 153#define emojiVariationSelector_Char ((iChar) 0xfe0f)