🐛 Fix problem with position data in Firefox

This commit is contained in:
alonso.torres 2026-04-16 18:08:34 +02:00
parent b02e05e23d
commit 47abe09cfe
3 changed files with 8 additions and 3 deletions

View File

@ -1764,11 +1764,11 @@
:direction (dr/translate-direction direction)
:font-id (get element :font-id)
:font-family (get element :font-family)
:font-size (get element :font-size)
:font-size (dm/str (get element :font-size) "px")
:font-weight (get element :font-weight)
:text-transform (get element :text-transform)
:text-decoration (get element :text-decoration)
:letter-spacing (get element :letter-spacing)
:letter-spacing (dm/str (get element :letter-spacing) "px")
:font-style (get element :font-style)
:fills (get element :fills)
:text text})))))))

View File

@ -968,6 +968,11 @@ impl RenderState {
.draw_rect(bounds, &paint);
}
// Uncomment to debug the render_position_data
// if let Type::Text(text_content) = &shape.shape_type {
// text::render_position_data(self, fills_surface_id, &shape, text_content);
// }
self.surfaces.apply_mut(surface_ids, |s| {
s.canvas()
.concat(&transform.invert().unwrap_or(Matrix::default()));

View File

@ -1551,7 +1551,7 @@ pub fn calculate_text_layout_data(
for (span_index, span) in text_para.children().iter().enumerate() {
let text: String = span.apply_text_transform();
let text_len = text.encode_utf16().count();
span_ranges.push((cur, cur + text_len + 1, span_index));
span_ranges.push((cur, cur + text_len, span_index));
cur += text_len;
}
for (start, end, span_index) in span_ranges {