mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 22:30:03 -04:00
More even text kerning (#7431)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
@@ -7,7 +7,7 @@ use emath::{Align2, Pos2, Rangef, Rect, TSTransform, Vec2, pos2};
|
||||
use crate::{
|
||||
Color32, CornerRadius, Mesh, Stroke, StrokeKind, TextureId,
|
||||
stroke::PathStroke,
|
||||
text::{FontId, Fonts, Galley},
|
||||
text::{FontId, FontsView, Galley},
|
||||
};
|
||||
|
||||
use super::{
|
||||
@@ -299,7 +299,7 @@ impl Shape {
|
||||
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn text(
|
||||
fonts: &Fonts,
|
||||
fonts: &mut FontsView<'_>,
|
||||
pos: Pos2,
|
||||
anchor: Align2,
|
||||
text: impl ToString,
|
||||
|
||||
@@ -15,7 +15,7 @@ pub struct TextShape {
|
||||
/// Usually the top left corner of the first character.
|
||||
pub pos: Pos2,
|
||||
|
||||
/// The laid out text, from [`Fonts::layout_job`].
|
||||
/// The laid out text, from [`FontsView::layout_job`].
|
||||
pub galley: Arc<Galley>,
|
||||
|
||||
/// Add this underline to the whole text.
|
||||
@@ -181,8 +181,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn text_bounding_box_under_rotation() {
|
||||
let fonts = Fonts::new(
|
||||
1.0,
|
||||
let mut fonts = Fonts::new(
|
||||
1024,
|
||||
AlphaFromCoverage::default(),
|
||||
FontDefinitions::default(),
|
||||
@@ -190,7 +189,7 @@ mod tests {
|
||||
let font = FontId::monospace(12.0);
|
||||
|
||||
let mut t = crate::Shape::text(
|
||||
&fonts,
|
||||
&mut fonts.with_pixels_per_point(1.0),
|
||||
Pos2::ZERO,
|
||||
emath::Align2::CENTER_CENTER,
|
||||
"testing123",
|
||||
|
||||
Reference in New Issue
Block a user