Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions frontends/rioterm/src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,13 @@ impl Renderer {
square.c
};

let font_attrs = match (
flags.contains(Flags::ITALIC),
flags.contains(Flags::BOLD_ITALIC),
flags.contains(Flags::BOLD),
) {
(true, _, _) => (Stretch::NORMAL, Weight::NORMAL, Style::Italic),
(_, true, _) => (Stretch::NORMAL, Weight::BOLD, Style::Italic),
(_, _, true) => (Stretch::NORMAL, Weight::BOLD, Style::Normal),
_ => (Stretch::NORMAL, Weight::NORMAL, Style::Normal),
};
let font_attrs =
match (flags.contains(Flags::BOLD), flags.contains(Flags::ITALIC)) {
(true, true) => (Stretch::NORMAL, Weight::BOLD, Style::Italic),
(true, false) => (Stretch::NORMAL, Weight::BOLD, Style::Normal),
(false, true) => (Stretch::NORMAL, Weight::NORMAL, Style::Italic),
_ => (Stretch::NORMAL, Weight::NORMAL, Style::Normal),
};

if flags.contains(Flags::INVERSE) {
std::mem::swap(&mut background_color, &mut foreground_color);
Expand Down
5 changes: 2 additions & 3 deletions sugarloaf/src/components/layer/atlas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ impl Atlas {
let offset = row * padded_width;
let src_row_bytes = (bytes_per_pixel * width) as usize;

padded_data[offset..offset + src_row_bytes].copy_from_slice(
&data[row * src_row_bytes..(row + 1) * src_row_bytes],
)
padded_data[offset..offset + src_row_bytes]
.copy_from_slice(&data[row * src_row_bytes..(row + 1) * src_row_bytes])
}

match &entry {
Expand Down
9 changes: 8 additions & 1 deletion sugarloaf/src/components/rich_text/image_cache/glyph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ impl GlyphCacheSession<'_> {
let font_data = font_library_data.get(&self.font);
let should_embolden = font_data.should_embolden;
let should_italicize = font_data.should_italicize;
let synth = font_data.synth;

if let Some((shared_data, offset, cache_key)) =
font_library_data.get_data(&self.font)
Expand All @@ -144,6 +145,12 @@ impl GlyphCacheSession<'_> {
offset,
key: cache_key,
};

let coords: Vec<_> = font_ref
.variations()
.normalized_coords(synth.variations().iter().copied())
.collect();

let mut scaler = self
.scale_context
.builder(font_ref)
Expand All @@ -155,7 +162,7 @@ impl GlyphCacheSession<'_> {
// .hint(!IS_MACOS)
.hint(enable_hint)
.size(self.quant_size.into())
// .normalized_coords(coords)
.normalized_coords(&coords)
.build();

// let embolden = if IS_MACOS { 0.25 } else { 0. };
Expand Down
11 changes: 9 additions & 2 deletions sugarloaf/src/font/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::font_introspector::text::cluster::Token;
use crate::font_introspector::text::cluster::{CharCluster, Status};
use crate::font_introspector::text::Codepoint;
use crate::font_introspector::text::Script;
use crate::font_introspector::{CacheKey, FontRef, Synthesis};
use crate::font_introspector::{Attributes, CacheKey, FontRef, Synthesis};
use crate::layout::FragmentStyle;
use crate::SugarloafErrors;
use dashmap::DashMap;
Expand Down Expand Up @@ -672,7 +672,14 @@ impl FontData {
let should_embolden = font_spec.weight >= Some(700) && weight < Weight(700);

let stretch = attributes.stretch();
let synth = attributes.synthesize(attributes);

let requested_weight = font_spec.weight.map(Weight).unwrap_or(Weight::NORMAL);
let requested_style = match font_spec.style {
SugarloafFontStyle::Italic => Style::Italic,
SugarloafFontStyle::Normal => Style::Normal,
};
let requested_attrs = Attributes::new(stretch, requested_weight, requested_style);
let synth = attributes.synthesize(requested_attrs);

let data = (!evictable).then_some(data);

Expand Down
Loading