Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Size::from_px constructor to f32 #60

Merged
merged 2 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- `Size::as_px` now returns `f32`.
- `Size::as_px` and `Size::from_px` now use `f32` type

## 0.6.0

### Changed

- `Size` now uses 6 floating point digits precision instead of rounding to 0.5.
- Add `Size::from_px`, `Size::as_px`, `Size::as_pt`, and `Size::scale`.
- Remove `Rasterizer::update_dpr`; users should scale fonts themselves.
- `Size` now uses 6 floating point digits precision instead of rounding to 0.5
- Add `Size::from_px`, `Size::as_px`, `Size::as_pt`, and `Size::scale`
- Remove `Rasterizer::update_dpr`; users should scale fonts themselves

## 0.5.2

Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ impl Size {
/// Create a new `Size` from px.
///
/// The value will be clamped to the pt range of [`Size::new`].
pub fn from_px(size: u16) -> Self {
let pt = size as f32 * 72. / 96.;
pub fn from_px(size: f32) -> Self {
let pt = size * 72. / 96.;
Size::new(pt)
}

Expand Down