Add set_hinting method to Buffer
This commit is contained in:
parent
d779057d9c
commit
a07a619054
14 changed files with 54 additions and 48 deletions
|
|
@ -1,8 +1,8 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use cosmic_text::{
|
||||
fontdb::Database, Attrs, AttrsOwned, Buffer, Color, Family, FontSystem, Hinting, Metrics,
|
||||
Shaping, SwashCache,
|
||||
fontdb::Database, Attrs, AttrsOwned, Buffer, Color, Family, FontSystem, Metrics, Shaping,
|
||||
SwashCache,
|
||||
};
|
||||
use tiny_skia::{Paint, Pixmap, Rect, Transform};
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ impl DrawTestCfg {
|
|||
let mut font_system = FontSystem::new_with_locale_and_db("En-US".into(), font_db);
|
||||
let mut swash_cache = SwashCache::new();
|
||||
let metrics = Metrics::new(self.font_size, self.line_height);
|
||||
let mut buffer = Buffer::new(&mut font_system, metrics, Hinting::Disabled);
|
||||
let mut buffer = Buffer::new(&mut font_system, metrics);
|
||||
let mut buffer = buffer.borrow_with(&mut font_system);
|
||||
let margins = 5;
|
||||
buffer.set_size(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use cosmic_text::{Buffer, Cursor, Edit, Hinting, Metrics, SyntaxEditor, SyntaxSystem, ViEditor};
|
||||
use cosmic_text::{Buffer, Cursor, Edit, Metrics, SyntaxEditor, SyntaxSystem, ViEditor};
|
||||
|
||||
static SYNTAX_SYSTEM: OnceLock<SyntaxSystem> = OnceLock::new();
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ fn editor() -> ViEditor<'static, 'static> {
|
|||
let line_height = (font_size * 1.4).ceil();
|
||||
|
||||
let metrics = Metrics::new(font_size, line_height);
|
||||
let buffer = Buffer::new_empty(metrics, Hinting::Disabled);
|
||||
let buffer = Buffer::new_empty(metrics);
|
||||
let editor = SyntaxEditor::new(
|
||||
buffer,
|
||||
SYNTAX_SYSTEM.get_or_init(SyntaxSystem::new),
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ fn wrap_extra_line() {
|
|||
let mut font_system = FontSystem::new();
|
||||
let metrics = Metrics::new(14.0, 20.0);
|
||||
|
||||
let mut buffer = Buffer::new(&mut font_system, metrics, Hinting::Disabled);
|
||||
let mut buffer = Buffer::new(&mut font_system, metrics);
|
||||
|
||||
let mut buffer = buffer.borrow_with(&mut font_system);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use cosmic_text::{Attrs, Buffer, FontSystem, Hinting, Metrics, Shaping, Wrap};
|
||||
use cosmic_text::{Attrs, Buffer, FontSystem, Metrics, Shaping, Wrap};
|
||||
|
||||
// Tests the ability to fallback to glyph wrapping when a word can't fit on a line by itself.
|
||||
// No line should ever overflow the buffer size.
|
||||
|
|
@ -10,7 +10,7 @@ fn wrap_word_fallback() {
|
|||
font_system.db_mut().load_font_data(font);
|
||||
let metrics = Metrics::new(14.0, 20.0);
|
||||
|
||||
let mut buffer = Buffer::new(&mut font_system, metrics, Hinting::Disabled);
|
||||
let mut buffer = Buffer::new(&mut font_system, metrics);
|
||||
|
||||
let mut buffer = buffer.borrow_with(&mut font_system);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue