Skip to content

TextArea::scale Breaks Cosmic Text Alignment #117

Description

@12AT7

When using alignment such as this:

    buffer.lines[0].set_align(Some(glyphon::cosmic_text::Align::Center));

With configuration like this:

     Some(glyphon::TextArea {
                buffer,
                left: bounds.location.x,
                top: bounds.location.y,
                scale: scale_factor,
                bounds: glyphon::TextBounds {
                    top: bounds.location.y as i32,
                    left: bounds.location.x as i32,
                    right: (bounds.location.x + bounds.size.width) as i32,
                    bottom: (bounds.location.y + bounds.size.height) as i32,
                },
                default_color: glyphon::Color::rgb(255, 255, 255),
                custom_glyphs: &[]
            })

the handling of scale seems to be troublesome. On my HiDPI monitor, scale is 2.67. The parameter appears to affect at least two features:

  1. Font scaling; this appears to work for me, and I do get reasonable font sizes on HiDPI
  2. Horizontal alignment; this does not work for me. I think it is positioning the text way, way to the right and off the screen. I think that Left works just because it is probably zero * big number.

Maybe this is a bug? Or maybe I am missing a parameter somewhere else?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions