Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kayak UI
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Bevy Forks
Kayak UI
Commits
74ff2849
Commit
74ff2849
authored
3 years ago
by
Gino Valente
Browse files
Options
Downloads
Patches
Plain Diff
Remove old code
parent
a23f400d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kayak_font/src/font.rs
+0
-129
0 additions, 129 deletions
kayak_font/src/font.rs
with
0 additions
and
129 deletions
kayak_font/src/font.rs
+
0
−
129
View file @
74ff2849
...
...
@@ -28,21 +28,6 @@ pub struct KayakFont {
max_glyph_size
:
(
f32
,
f32
),
}
// TODO: Remove me
// #[derive(Default, Debug, Clone, Copy)]
// pub struct LayoutRect {
// pub position: (f32, f32),
// pub size: (f32, f32),
// pub content: char,
// }
// TODO: Remove me (?)
// #[derive(Debug, Clone, Copy, PartialEq)]
// pub enum CoordinateSystem {
// PositiveYUp,
// PositiveYDown,
// }
impl
KayakFont
{
pub
fn
new
(
sdf
:
Sdf
,
#[cfg(feature
=
"bevy_renderer"
)]
atlas_image
:
Handle
<
Image
>
)
->
Self
{
let
max_glyph_size
=
sdf
.max_glyph_size
();
...
...
@@ -422,118 +407,4 @@ impl KayakFont {
let
font_scale
=
font_size
/
self
.sdf.atlas.font_size
;
(
self
.max_glyph_size
.0
*
font_scale
,
self
.max_glyph_size
.1
*
font_scale
)
}
// TODO: Remove
// pub fn get_layout(
// &self,
// axis_alignment: CoordinateSystem,
// alignment: Alignment,
// position: (f32, f32),
// max_size: (f32, f32),
// content: &String,
// line_height: f32,
// font_size: f32,
// ) -> Vec<LayoutRect> {
// let mut positions_and_size = Vec::new();
// let max_glyph_size = self.sdf.max_glyph_size();
// let font_ratio = font_size / self.sdf.atlas.font_size;
// let resized_max_glyph_size = (max_glyph_size.0 * font_ratio, max_glyph_size.1 * font_ratio);
//
// // TODO: Make this configurable?
// let split_chars = vec![' ', '\t'];
// let missing_chars: Vec<char> = content
// .chars()
// .filter(|c| split_chars.iter().any(|c2| c == c2))
// .collect();
//
// let shift_sign = match axis_alignment {
// CoordinateSystem::PositiveYDown => -1.0,
// CoordinateSystem::PositiveYUp => 1.0,
// };
//
// let mut line_widths = Vec::new();
//
// let mut x = 0.0;
// let mut y = 0.0;
// let mut i = 0;
// let mut line_starting_index = 0;
// let mut last_width = 0.0;
// for word in content.split(&split_chars[..]) {
// let word_width = self.get_word_width(word, TextProperties::default());
// if x + word_width + (font_size / 2.0) > max_size.0 {
// y -= shift_sign * line_height;
// line_widths.push((x, line_starting_index, positions_and_size.len()));
// line_starting_index = positions_and_size.len();
// x = 0.0;
// }
// for c in word.chars() {
// if c == '\n' {
// y -= shift_sign * line_height;
// line_widths.push((x, line_starting_index, positions_and_size.len()));
// line_starting_index = positions_and_size.len();
// x = 0.0;
// }
//
// if let Some(glyph) = self.get_glyph(c) {
// let plane_bounds = glyph.plane_bounds.as_ref();
// let (left, top, width, _height) = match plane_bounds {
// Some(val) => (
// val.left,
// val.top,
// val.size().0 * font_size,
// val.size().1 * font_size,
// ),
// None => (0.0, 0.0, 0.0, 0.0),
// };
//
// last_width = width;
//
// let position_x = x + left * font_size;
// let position_y =
// y + (shift_sign * top * font_size) + ((line_height - font_size) / 2.0);
//
// positions_and_size.push(LayoutRect {
// position: (position_x, position_y),
// size: (resized_max_glyph_size.0, resized_max_glyph_size.1),
// content: c,
// });
//
// x += glyph.advance * font_size;
// }
// }
// if let Some(next_missing) = missing_chars.get(i) {
// if let Some(glyph) = self
// .sdf
// .glyphs
// .iter()
// .find(|glyph| glyph.unicode == *next_missing)
// {
// x += glyph.advance * font_size;
// }
// i += 1;
// }
// }
//
// line_widths.push((
// x + last_width,
// line_starting_index,
// positions_and_size.len(),
// ));
//
// for (line_width, starting_index, end_index) in line_widths {
// let shift_x = match alignment {
// Alignment::Start => 0.0,
// Alignment::Middle => (max_size.0 - line_width) / 2.0,
// Alignment::End => max_size.0 - line_width,
// };
// for i in starting_index..end_index {
// let layout_rect = &mut positions_and_size[i];
//
// layout_rect.position.0 += position.0 + shift_x;
// layout_rect.position.1 += position.1;
// }
// }
//
// positions_and_size
// }
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment