Colour href labels from hypersetup
This commit is contained in:
1 parent
8f429b892b
commit
ea89bc1522
6 files changed
+58
-26
No files matched your search
@@ -46,6 +46,7 @@ pub enum InlineSegment {
|
||||
font: ParagraphFont,
|
||||
url: String,
|
||||
text: String,
|
||||
color: Option<[u8; 3]>,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1767,7 +1768,12 @@ pub fn layout_paragraph_segments(segments: &[InlineSegment], style: &ParagraphSt
|
||||
previous = Some((*font, text.clone()));
|
||||
seen_content = true;
|
||||
}
|
||||
InlineSegment::Link { font, url, text } => {
|
||||
InlineSegment::Link {
|
||||
font,
|
||||
url,
|
||||
text,
|
||||
color,
|
||||
} => {
|
||||
if text.is_empty() {
|
||||
continue;
|
||||
}
|
||||
@@ -1798,6 +1804,7 @@ pub fn layout_paragraph_segments(segments: &[InlineSegment], style: &ParagraphSt
|
||||
for item in &mut run {
|
||||
if let HorizontalItem::Box(box_) = item {
|
||||
box_.font = Some(*font);
|
||||
box_.color = *color;
|
||||
box_.link = Some(url.clone());
|
||||
}
|
||||
}
|
||||
@@ -2110,6 +2117,7 @@ mod tests {
|
||||
font: ParagraphFont::Roman,
|
||||
url: "https://example.com".into(),
|
||||
text: "there".into(),
|
||||
color: None,
|
||||
},
|
||||
InlineSegment::Text(ParagraphFont::Roman, " now".into()),
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user