1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

Layout fixes (#651)

* Fix incorrect max_width/height of panels

* Fix set_width/set_min_width/set_height/set_min_height

Closes https://github.com/emilk/egui/issues/647

Broke in https://github.com/emilk/egui/pull/629

* Fix expand_to_include_x/expand_to_include_y

* Make minimum grid column width propagate properly

* Expand cursor when max_rect expands

* Add ui.expand_to_include_y

* Only expand cursor in advance

* demo: clean up font_book code

* Fix: Make sure `TextEdit` contents expand to fill width if applicable

* ProgressBar: minimum width and fix for having it in an infinite layout

* clippy fix
This commit is contained in:
Emil Ernerfeldt
2021-08-26 18:50:30 +02:00
committed by GitHub
parent 3a634ff46e
commit 693426d9c6
9 changed files with 201 additions and 159 deletions

View File

@@ -108,144 +108,147 @@ impl super::View for FontBook {
}
fn char_name(chr: char) -> String {
unicode_names2::name(chr)
.map(|name| name.to_string().to_lowercase())
.unwrap_or_else(|| {
#[allow(clippy::match_same_arms)]
match chr {
// Special private-use-area extensions found in `emoji-icon-font.ttf`:
// Private use area extensions:
'\u{FE4E5}' => "flag japan".to_owned(),
'\u{FE4E6}' => "flag usa".to_owned(),
'\u{FE4E7}' => "flag".to_owned(),
'\u{FE4E8}' => "flag".to_owned(),
'\u{FE4E9}' => "flag".to_owned(),
'\u{FE4EA}' => "flag great britain".to_owned(),
'\u{FE4EB}' => "flag".to_owned(),
'\u{FE4EC}' => "flag".to_owned(),
'\u{FE4ED}' => "flag".to_owned(),
'\u{FE4EE}' => "flag south korea".to_owned(),
'\u{FE82C}' => "number sign in square".to_owned(),
'\u{FE82E}' => "digit one in square".to_owned(),
'\u{FE82F}' => "digit two in square".to_owned(),
'\u{FE830}' => "digit three in square".to_owned(),
'\u{FE831}' => "digit four in square".to_owned(),
'\u{FE832}' => "digit five in square".to_owned(),
'\u{FE833}' => "digit six in square".to_owned(),
'\u{FE834}' => "digit seven in square".to_owned(),
'\u{FE835}' => "digit eight in square".to_owned(),
'\u{FE836}' => "digit nine in square".to_owned(),
'\u{FE837}' => "digit zero in square".to_owned(),
// Special private-use-area extensions found in `emoji-icon-font.ttf`:
// Web services / operating systems / browsers
'\u{E600}' => "web-dribbble".to_owned(),
'\u{E601}' => "web-stackoverflow".to_owned(),
'\u{E602}' => "web-vimeo".to_owned(),
'\u{E603}' => "web-twitter".to_owned(),
'\u{E604}' => "web-facebook".to_owned(),
'\u{E605}' => "web-googleplus".to_owned(),
'\u{E606}' => "web-pinterest".to_owned(),
'\u{E607}' => "web-tumblr".to_owned(),
'\u{E608}' => "web-linkedin".to_owned(),
'\u{E60A}' => "web-stumbleupon".to_owned(),
'\u{E60B}' => "web-lastfm".to_owned(),
'\u{E60C}' => "web-rdio".to_owned(),
'\u{E60D}' => "web-spotify".to_owned(),
'\u{E60E}' => "web-qq".to_owned(),
'\u{E60F}' => "web-instagram".to_owned(),
'\u{E610}' => "web-dropbox".to_owned(),
'\u{E611}' => "web-evernote".to_owned(),
'\u{E612}' => "web-flattr".to_owned(),
'\u{E613}' => "web-skype".to_owned(),
'\u{E614}' => "web-renren".to_owned(),
'\u{E615}' => "web-sina-weibo".to_owned(),
'\u{E616}' => "web-paypal".to_owned(),
'\u{E617}' => "web-picasa".to_owned(),
'\u{E618}' => "os-android".to_owned(),
'\u{E619}' => "web-mixi".to_owned(),
'\u{E61A}' => "web-behance".to_owned(),
'\u{E61B}' => "web-circles".to_owned(),
'\u{E61C}' => "web-vk".to_owned(),
'\u{E61D}' => "web-smashing".to_owned(),
'\u{E61E}' => "web-forrst".to_owned(),
'\u{E61F}' => "os-windows".to_owned(),
'\u{E620}' => "web-flickr".to_owned(),
'\u{E621}' => "web-picassa".to_owned(),
'\u{E622}' => "web-deviantart".to_owned(),
'\u{E623}' => "web-steam".to_owned(),
'\u{E624}' => "web-github".to_owned(),
'\u{E625}' => "web-git".to_owned(),
'\u{E626}' => "web-blogger".to_owned(),
'\u{E627}' => "web-soundcloud".to_owned(),
'\u{E628}' => "web-reddit".to_owned(),
'\u{E629}' => "web-delicious".to_owned(),
'\u{E62A}' => "browser-chrome".to_owned(),
'\u{E62B}' => "browser-firefox".to_owned(),
'\u{E62C}' => "browser-ie".to_owned(),
'\u{E62D}' => "browser-opera".to_owned(),
'\u{E62E}' => "browser-safari".to_owned(),
'\u{E62F}' => "web-google-drive".to_owned(),
'\u{E630}' => "web-wordpress".to_owned(),
'\u{E631}' => "web-joomla".to_owned(),
'\u{E632}' => "lastfm".to_owned(),
'\u{E633}' => "web-foursquare".to_owned(),
'\u{E634}' => "web-yelp".to_owned(),
'\u{E635}' => "web-drupal".to_owned(),
'\u{E636}' => "youtube".to_owned(),
'\u{F189}' => "vk".to_owned(),
'\u{F1A6}' => "digg".to_owned(),
'\u{F1CA}' => "web-vine".to_owned(),
'\u{F8FF}' => "os-apple".to_owned(),
// Special private-use-area extensions found in `Ubuntu-Light.ttf`
'\u{F000}' => "uniF000".to_owned(),
'\u{F001}' => "fi".to_owned(),
'\u{F002}' => "fl".to_owned(),
'\u{F506}' => "one seventh".to_owned(),
'\u{F507}' => "two sevenths".to_owned(),
'\u{F508}' => "three sevenths".to_owned(),
'\u{F509}' => "four sevenths".to_owned(),
'\u{F50A}' => "fiv esevenths".to_owned(),
'\u{F50B}' => "six sevenths".to_owned(),
'\u{F50C}' => "one ninth".to_owned(),
'\u{F50D}' => "two ninths".to_owned(),
'\u{F50E}' => "four ninths".to_owned(),
'\u{F50F}' => "five ninths".to_owned(),
'\u{F510}' => "seven ninths".to_owned(),
'\u{F511}' => "eight ninths".to_owned(),
'\u{F800}' => "zero.alt".to_owned(),
'\u{F801}' => "one.alt".to_owned(),
'\u{F802}' => "two.alt".to_owned(),
'\u{F803}' => "three.alt".to_owned(),
'\u{F804}' => "four.alt".to_owned(),
'\u{F805}' => "five.alt".to_owned(),
'\u{F806}' => "six.alt".to_owned(),
'\u{F807}' => "seven.alt".to_owned(),
'\u{F808}' => "eight.alt".to_owned(),
'\u{F809}' => "nine.alt".to_owned(),
'\u{F80A}' => "zero.sups".to_owned(),
'\u{F80B}' => "one.sups".to_owned(),
'\u{F80C}' => "two.sups".to_owned(),
'\u{F80D}' => "three.sups".to_owned(),
'\u{F80E}' => "four.sups".to_owned(),
'\u{F80F}' => "five.sups".to_owned(),
'\u{F810}' => "six.sups".to_owned(),
'\u{F811}' => "seven.sups".to_owned(),
'\u{F812}' => "eight.sups".to_owned(),
'\u{F813}' => "nine.sups".to_owned(),
'\u{F814}' => "zero.sinf".to_owned(),
'\u{F815}' => "one.sinf".to_owned(),
'\u{F816}' => "two.sinf".to_owned(),
'\u{F817}' => "three.sinf".to_owned(),
'\u{F818}' => "four.sinf".to_owned(),
'\u{F819}' => "five.sinf".to_owned(),
'\u{F81A}' => "six.sinf".to_owned(),
'\u{F81B}' => "seven.sinf".to_owned(),
'\u{F81C}' => "eight.sinf".to_owned(),
'\u{F81D}' => "nine.sinf".to_owned(),
_ => "unknown".to_owned(),
}
})
special_char_name(chr)
.map(|s| s.to_owned())
.or_else(|| unicode_names2::name(chr).map(|name| name.to_string().to_lowercase()))
.unwrap_or_else(|| "unknown".to_owned())
}
fn special_char_name(chr: char) -> Option<&'static str> {
#[allow(clippy::match_same_arms)] // many "flag"
match chr {
// Special private-use-area extensions found in `emoji-icon-font.ttf`:
// Private use area extensions:
'\u{FE4E5}' => Some("flag japan"),
'\u{FE4E6}' => Some("flag usa"),
'\u{FE4E7}' => Some("flag"),
'\u{FE4E8}' => Some("flag"),
'\u{FE4E9}' => Some("flag"),
'\u{FE4EA}' => Some("flag great britain"),
'\u{FE4EB}' => Some("flag"),
'\u{FE4EC}' => Some("flag"),
'\u{FE4ED}' => Some("flag"),
'\u{FE4EE}' => Some("flag south korea"),
'\u{FE82C}' => Some("number sign in square"),
'\u{FE82E}' => Some("digit one in square"),
'\u{FE82F}' => Some("digit two in square"),
'\u{FE830}' => Some("digit three in square"),
'\u{FE831}' => Some("digit four in square"),
'\u{FE832}' => Some("digit five in square"),
'\u{FE833}' => Some("digit six in square"),
'\u{FE834}' => Some("digit seven in square"),
'\u{FE835}' => Some("digit eight in square"),
'\u{FE836}' => Some("digit nine in square"),
'\u{FE837}' => Some("digit zero in square"),
// Special private-use-area extensions found in `emoji-icon-font.ttf`:
// Web services / operating systems / browsers
'\u{E600}' => Some("web-dribbble"),
'\u{E601}' => Some("web-stackoverflow"),
'\u{E602}' => Some("web-vimeo"),
'\u{E603}' => Some("web-twitter"),
'\u{E604}' => Some("web-facebook"),
'\u{E605}' => Some("web-googleplus"),
'\u{E606}' => Some("web-pinterest"),
'\u{E607}' => Some("web-tumblr"),
'\u{E608}' => Some("web-linkedin"),
'\u{E60A}' => Some("web-stumbleupon"),
'\u{E60B}' => Some("web-lastfm"),
'\u{E60C}' => Some("web-rdio"),
'\u{E60D}' => Some("web-spotify"),
'\u{E60E}' => Some("web-qq"),
'\u{E60F}' => Some("web-instagram"),
'\u{E610}' => Some("web-dropbox"),
'\u{E611}' => Some("web-evernote"),
'\u{E612}' => Some("web-flattr"),
'\u{E613}' => Some("web-skype"),
'\u{E614}' => Some("web-renren"),
'\u{E615}' => Some("web-sina-weibo"),
'\u{E616}' => Some("web-paypal"),
'\u{E617}' => Some("web-picasa"),
'\u{E618}' => Some("os-android"),
'\u{E619}' => Some("web-mixi"),
'\u{E61A}' => Some("web-behance"),
'\u{E61B}' => Some("web-circles"),
'\u{E61C}' => Some("web-vk"),
'\u{E61D}' => Some("web-smashing"),
'\u{E61E}' => Some("web-forrst"),
'\u{E61F}' => Some("os-windows"),
'\u{E620}' => Some("web-flickr"),
'\u{E621}' => Some("web-picassa"),
'\u{E622}' => Some("web-deviantart"),
'\u{E623}' => Some("web-steam"),
'\u{E624}' => Some("web-github"),
'\u{E625}' => Some("web-git"),
'\u{E626}' => Some("web-blogger"),
'\u{E627}' => Some("web-soundcloud"),
'\u{E628}' => Some("web-reddit"),
'\u{E629}' => Some("web-delicious"),
'\u{E62A}' => Some("browser-chrome"),
'\u{E62B}' => Some("browser-firefox"),
'\u{E62C}' => Some("browser-ie"),
'\u{E62D}' => Some("browser-opera"),
'\u{E62E}' => Some("browser-safari"),
'\u{E62F}' => Some("web-google-drive"),
'\u{E630}' => Some("web-wordpress"),
'\u{E631}' => Some("web-joomla"),
'\u{E632}' => Some("lastfm"),
'\u{E633}' => Some("web-foursquare"),
'\u{E634}' => Some("web-yelp"),
'\u{E635}' => Some("web-drupal"),
'\u{E636}' => Some("youtube"),
'\u{F189}' => Some("vk"),
'\u{F1A6}' => Some("digg"),
'\u{F1CA}' => Some("web-vine"),
'\u{F8FF}' => Some("os-apple"),
// Special private-use-area extensions found in `Ubuntu-Light.ttf`
'\u{F000}' => Some("uniF000"),
'\u{F001}' => Some("fi"),
'\u{F002}' => Some("fl"),
'\u{F506}' => Some("one seventh"),
'\u{F507}' => Some("two sevenths"),
'\u{F508}' => Some("three sevenths"),
'\u{F509}' => Some("four sevenths"),
'\u{F50A}' => Some("five sevenths"),
'\u{F50B}' => Some("six sevenths"),
'\u{F50C}' => Some("one ninth"),
'\u{F50D}' => Some("two ninths"),
'\u{F50E}' => Some("four ninths"),
'\u{F50F}' => Some("five ninths"),
'\u{F510}' => Some("seven ninths"),
'\u{F511}' => Some("eight ninths"),
'\u{F800}' => Some("zero.alt"),
'\u{F801}' => Some("one.alt"),
'\u{F802}' => Some("two.alt"),
'\u{F803}' => Some("three.alt"),
'\u{F804}' => Some("four.alt"),
'\u{F805}' => Some("five.alt"),
'\u{F806}' => Some("six.alt"),
'\u{F807}' => Some("seven.alt"),
'\u{F808}' => Some("eight.alt"),
'\u{F809}' => Some("nine.alt"),
'\u{F80A}' => Some("zero.sups"),
'\u{F80B}' => Some("one.sups"),
'\u{F80C}' => Some("two.sups"),
'\u{F80D}' => Some("three.sups"),
'\u{F80E}' => Some("four.sups"),
'\u{F80F}' => Some("five.sups"),
'\u{F810}' => Some("six.sups"),
'\u{F811}' => Some("seven.sups"),
'\u{F812}' => Some("eight.sups"),
'\u{F813}' => Some("nine.sups"),
'\u{F814}' => Some("zero.sinf"),
'\u{F815}' => Some("one.sinf"),
'\u{F816}' => Some("two.sinf"),
'\u{F817}' => Some("three.sinf"),
'\u{F818}' => Some("four.sinf"),
'\u{F819}' => Some("five.sinf"),
'\u{F81A}' => Some("six.sinf"),
'\u{F81B}' => Some("seven.sinf"),
'\u{F81C}' => Some("eight.sinf"),
'\u{F81D}' => Some("nine.sinf"),
_ => None,
}
}