Use floating coordinates directly in text::Pipeline
This commit is contained in:
parent
238154af4a
commit
5a82fc654e
2 changed files with 8 additions and 8 deletions
|
|
@ -52,7 +52,8 @@ path = "../graphics"
|
||||||
|
|
||||||
[dependencies.glyphon]
|
[dependencies.glyphon]
|
||||||
version = "0.2"
|
version = "0.2"
|
||||||
path = "../../glyphon"
|
git = "https://github.com/hecrj/glyphon.git"
|
||||||
|
rev = "bffca9b958af11d1bfd0c0d1a281fc8799cc5a5b"
|
||||||
|
|
||||||
[dependencies.tracing]
|
[dependencies.tracing]
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ impl Pipeline {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let cursor = paragraph.hit(point.x as i32, point.y as i32)?;
|
let cursor = paragraph.hit(point.x, point.y)?;
|
||||||
|
|
||||||
Some(Hit::CharOffset(cursor.index))
|
Some(Hit::CharOffset(cursor.index))
|
||||||
})
|
})
|
||||||
|
|
@ -329,21 +329,20 @@ impl<'a> Cache<'a> {
|
||||||
let mut hasher = self.hasher.build_hasher();
|
let mut hasher = self.hasher.build_hasher();
|
||||||
|
|
||||||
key.content.hash(&mut hasher);
|
key.content.hash(&mut hasher);
|
||||||
(key.size as i32).hash(&mut hasher);
|
key.size.to_bits().hash(&mut hasher);
|
||||||
key.font.hash(&mut hasher);
|
key.font.hash(&mut hasher);
|
||||||
(key.bounds.width as i32).hash(&mut hasher);
|
key.bounds.width.to_bits().hash(&mut hasher);
|
||||||
(key.bounds.height as i32).hash(&mut hasher);
|
key.bounds.height.to_bits().hash(&mut hasher);
|
||||||
key.color.into_rgba8().hash(&mut hasher);
|
key.color.into_rgba8().hash(&mut hasher);
|
||||||
|
|
||||||
hasher.finish()
|
hasher.finish()
|
||||||
};
|
};
|
||||||
|
|
||||||
if !self.entries.contains_key(&hash) {
|
if !self.entries.contains_key(&hash) {
|
||||||
let metrics =
|
let metrics = glyphon::Metrics::new(key.size, key.size * 1.2);
|
||||||
glyphon::Metrics::new(key.size as i32, (key.size * 1.2) as i32);
|
|
||||||
let mut buffer = glyphon::Buffer::new(&fonts, metrics);
|
let mut buffer = glyphon::Buffer::new(&fonts, metrics);
|
||||||
|
|
||||||
buffer.set_size(key.bounds.width as i32, key.bounds.height as i32);
|
buffer.set_size(key.bounds.width, key.bounds.height);
|
||||||
buffer.set_text(
|
buffer.set_text(
|
||||||
key.content,
|
key.content,
|
||||||
glyphon::Attrs::new().family(to_family(key.font)).color({
|
glyphon::Attrs::new().family(to_family(key.font)).color({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue