summaryrefslogtreecommitdiffstats
path: root/modules/text_server_fb/text_server_fb.h
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-05-06 16:20:20 +0200
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-05-08 12:37:42 +0200
commita0dbdcc3abbd3e6307c6e68d0e60f8c0fa31d576 (patch)
tree0b8d0a36f69e28096b06956ebbe2c5e6f7e403a3 /modules/text_server_fb/text_server_fb.h
parent281fe39929303a8ef12e72ff7999b849bbe0678d (diff)
downloadredot-engine-a0dbdcc3abbd3e6307c6e68d0e60f8c0fa31d576.tar.gz
Replace `find` with `contains/has` where applicable
* Replaces `find(...) != -1` with `contains` for `String` * Replaces `find(...) == -1` with `!contains` for `String` * Replaces `find(...) != -1` with `has` for containers * Replaces `find(...) == -1` with `!has` for containers
Diffstat (limited to 'modules/text_server_fb/text_server_fb.h')
-rw-r--r--modules/text_server_fb/text_server_fb.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h
index 31370c7da7..9ad20c7b26 100644
--- a/modules/text_server_fb/text_server_fb.h
+++ b/modules/text_server_fb/text_server_fb.h
@@ -335,54 +335,54 @@ class TextServerFallback : public TextServerExtension {
_FORCE_INLINE_ int _font_get_weight_by_name(const String &p_sty_name) const {
String sty_name = p_sty_name.replace(" ", "").replace("-", "");
- if (sty_name.find("thin") >= 0 || sty_name.find("hairline") >= 0) {
+ if (sty_name.contains("thin") || sty_name.contains("hairline")) {
return 100;
- } else if (sty_name.find("extralight") >= 0 || sty_name.find("ultralight") >= 0) {
+ } else if (sty_name.contains("extralight") || sty_name.contains("ultralight")) {
return 200;
- } else if (sty_name.find("light") >= 0) {
+ } else if (sty_name.contains("light")) {
return 300;
- } else if (sty_name.find("semilight") >= 0) {
+ } else if (sty_name.contains("semilight")) {
return 350;
- } else if (sty_name.find("regular") >= 0) {
+ } else if (sty_name.contains("regular")) {
return 400;
- } else if (sty_name.find("medium") >= 0) {
+ } else if (sty_name.contains("medium")) {
return 500;
- } else if (sty_name.find("semibold") >= 0 || sty_name.find("demibold") >= 0) {
+ } else if (sty_name.contains("semibold") || sty_name.contains("demibold")) {
return 600;
- } else if (sty_name.find("bold") >= 0) {
+ } else if (sty_name.contains("bold")) {
return 700;
- } else if (sty_name.find("extrabold") >= 0 || sty_name.find("ultrabold") >= 0) {
+ } else if (sty_name.contains("extrabold") || sty_name.contains("ultrabold")) {
return 800;
- } else if (sty_name.find("black") >= 0 || sty_name.find("heavy") >= 0) {
+ } else if (sty_name.contains("black") || sty_name.contains("heavy")) {
return 900;
- } else if (sty_name.find("extrablack") >= 0 || sty_name.find("ultrablack") >= 0) {
+ } else if (sty_name.contains("extrablack") || sty_name.contains("ultrablack")) {
return 950;
}
return 400;
}
_FORCE_INLINE_ int _font_get_stretch_by_name(const String &p_sty_name) const {
String sty_name = p_sty_name.replace(" ", "").replace("-", "");
- if (sty_name.find("ultracondensed") >= 0) {
+ if (sty_name.contains("ultracondensed")) {
return 50;
- } else if (sty_name.find("extracondensed") >= 0) {
+ } else if (sty_name.contains("extracondensed")) {
return 63;
- } else if (sty_name.find("condensed") >= 0) {
+ } else if (sty_name.contains("condensed")) {
return 75;
- } else if (sty_name.find("semicondensed") >= 0) {
+ } else if (sty_name.contains("semicondensed")) {
return 87;
- } else if (sty_name.find("semiexpanded") >= 0) {
+ } else if (sty_name.contains("semiexpanded")) {
return 113;
- } else if (sty_name.find("expanded") >= 0) {
+ } else if (sty_name.contains("expanded")) {
return 125;
- } else if (sty_name.find("extraexpanded") >= 0) {
+ } else if (sty_name.contains("extraexpanded")) {
return 150;
- } else if (sty_name.find("ultraexpanded") >= 0) {
+ } else if (sty_name.contains("ultraexpanded")) {
return 200;
}
return 100;
}
_FORCE_INLINE_ bool _is_ital_style(const String &p_sty_name) const {
- return (p_sty_name.find("italic") >= 0) || (p_sty_name.find("oblique") >= 0);
+ return p_sty_name.contains("italic") || p_sty_name.contains("oblique");
}
// Shaped text cache data.