Skip to content

Commit

Permalink
let's render on center
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Dec 22, 2024
1 parent da8ed42 commit 7d6cdbe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion docs/docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ language: 'en'

## 0.2.3 (unreleased)

- Fixed Nix build [#853](https://github.com/raphamorim/rio/pull/853).
- Fixed: Nix build [#853](https://github.com/raphamorim/rio/pull/853).
- Support to line height.
- Fixed: Unremovable bottom padding when using line-height [#449](https://github.com/raphamorim/rio/issues/449).
- On macOS, fixed undocumented cursors (e.g. zoom, resize, help) always appearing to be invalid and falling back to the default cursor.
- On X11, Wayland, Windows and macOS, improved scancode conversions for more obscure key codes.
- On macOS, fixed the scancode conversion for audio volume keys.
Expand Down
4 changes: 2 additions & 2 deletions sugarloaf/src/components/rich_text/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,10 @@ fn draw_layout(
let mut px = x + 0.0;
// let baseline = line_y + ascent;
// line_y = baseline + descent;
line_y = line_y + rect.height;
line_y = line_y + rect.height * 2.0;
let py = line_y;
// let line_height = ascent + descent + leading;
let line_height = rect.height;
let line_height = rect.height * 2.0;
for run in &line.render_data.runs {
glyphs.clear();
let font = run.span.font_id;
Expand Down
2 changes: 1 addition & 1 deletion sugarloaf/src/layout/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ impl Content {
let render_data = content.get_state(&id).unwrap().lines[0].clone();

if let Some(dimension) = advance_brush.dimensions(&self.fonts, &render_data) {
rte.layout.dimensions.height = dimension.height * rte.layout.line_height;
rte.layout.dimensions.height = dimension.height;
rte.layout.dimensions.width = dimension.width;
}
}
Expand Down
4 changes: 2 additions & 2 deletions sugarloaf/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ impl Default for RootStyle {

impl RootStyle {
pub fn new(scale_factor: f32, font_size: f32, line_height: f32) -> RootStyle {
// Line height can never be zero
// let line_height = if line_height == 0.0 { 1.0 } else { line_height };
// Line height cannot be under 1
let line_height = if line_height <= 1.0 { 1.0 } else { line_height };

RootStyle {
scale_factor,
Expand Down

0 comments on commit 7d6cdbe

Please sign in to comment.