commit cc510967bc6c64c8609ea9244f557ef10d5c4eda Author: rapture.party Date: Thu Apr 2 17:52:02 2026 -0400 Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d61ca32 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,365 @@ +root = true + +# All files +[*] +indent_style = space +max_line_length = 80 + +# Xml files +[*.xml] +indent_size = 2 + +# C# files +[*.cs] + +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 +tab_width = 4 + +# New line preferences +end_of_line = crlf +insert_final_newline = true + +#### .NET Coding Conventions #### +[*.{cs,vb}] + +# Organize usings +dotnet_separate_import_directive_groups = true +dotnet_sort_system_directives_first = true +file_header_template = unset + +# this. and Me. preferences +dotnet_style_qualification_for_event = false:silent +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_property = false:silent + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent + +# Expression-level preferences +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_return = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion + +# Field preferences +dotnet_style_readonly_field = true:warning + +# Parameter preferences +dotnet_code_quality_unused_parameters = all:suggestion + +# Suppression preferences +dotnet_remove_unnecessary_suppression_exclusions = none + +#### C# Coding Conventions #### +[*.cs] + +# var preferences +csharp_style_var_elsewhere = false:silent +csharp_style_var_for_built_in_types = false:silent +csharp_style_var_when_type_is_apparent = false:silent + +# Expression-bodied members +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_lambdas = true:suggestion +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent + +# Pattern matching preferences +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_prefer_not_pattern = true:suggestion +csharp_style_prefer_pattern_matching = true:silent +csharp_style_prefer_switch_expression = true:suggestion + +# Null-checking preferences +csharp_style_conditional_delegate_call = true:suggestion + +# Modifier preferences +csharp_prefer_static_local_function = true:warning +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent + +# Code-block preferences +csharp_prefer_braces = true:silent +csharp_prefer_simple_using_statement = true:suggestion + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_pattern_local_over_anonymous_function = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace:silent + +#### C# Formatting Rules #### + +# New line preferences +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_labels = one_less_than_current +csharp_indent_switch_labels = true + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + +#### Naming styles #### +[*.{cs,vb}] + +# Naming rules + +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.interfaces_should_be_ipascalcase.severity = suggestion +dotnet_naming_rule.interfaces_should_be_ipascalcase.symbols = interfaces +dotnet_naming_rule.interfaces_should_be_ipascalcase.style = ipascalcase + +dotnet_naming_rule.type_parameters_should_be_tpascalcase.severity = suggestion +dotnet_naming_rule.type_parameters_should_be_tpascalcase.symbols = type_parameters +dotnet_naming_rule.type_parameters_should_be_tpascalcase.style = tpascalcase + +dotnet_naming_rule.methods_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.methods_should_be_pascalcase.symbols = methods +dotnet_naming_rule.methods_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.properties_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.properties_should_be_pascalcase.symbols = properties +dotnet_naming_rule.properties_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.events_should_be_pascalcase.symbols = events +dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion +dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables +dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase + +dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion +dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants +dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase + +dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion +dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters +dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase + +dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields +dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion +dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields +dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase + +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase + +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums +dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions +dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase + +# Symbol specifications + +dotnet_naming_symbols.interfaces.applicable_kinds = interface +dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interfaces.required_modifiers = + +dotnet_naming_symbols.enums.applicable_kinds = enum +dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.enums.required_modifiers = + +dotnet_naming_symbols.events.applicable_kinds = event +dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.events.required_modifiers = + +dotnet_naming_symbols.methods.applicable_kinds = method +dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.methods.required_modifiers = + +dotnet_naming_symbols.properties.applicable_kinds = property +dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.properties.required_modifiers = + +dotnet_naming_symbols.public_fields.applicable_kinds = field +dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_fields.required_modifiers = + +dotnet_naming_symbols.private_fields.applicable_kinds = field +dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_fields.required_modifiers = + +dotnet_naming_symbols.private_static_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_static_fields.required_modifiers = static + +dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum +dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types_and_namespaces.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +dotnet_naming_symbols.type_parameters.applicable_kinds = namespace +dotnet_naming_symbols.type_parameters.applicable_accessibilities = * +dotnet_naming_symbols.type_parameters.required_modifiers = + +dotnet_naming_symbols.private_constant_fields.applicable_kinds = field +dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_constant_fields.required_modifiers = const + +dotnet_naming_symbols.local_variables.applicable_kinds = local +dotnet_naming_symbols.local_variables.applicable_accessibilities = local +dotnet_naming_symbols.local_variables.required_modifiers = + +dotnet_naming_symbols.local_constants.applicable_kinds = local +dotnet_naming_symbols.local_constants.applicable_accessibilities = local +dotnet_naming_symbols.local_constants.required_modifiers = const + +dotnet_naming_symbols.parameters.applicable_kinds = parameter +dotnet_naming_symbols.parameters.applicable_accessibilities = * +dotnet_naming_symbols.parameters.required_modifiers = + +dotnet_naming_symbols.public_constant_fields.applicable_kinds = field +dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_constant_fields.required_modifiers = const + +dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static + +dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static + +dotnet_naming_symbols.local_functions.applicable_kinds = local_function +dotnet_naming_symbols.local_functions.applicable_accessibilities = * +dotnet_naming_symbols.local_functions.required_modifiers = + +# Naming styles + +dotnet_naming_style.pascalcase.required_prefix = +dotnet_naming_style.pascalcase.required_suffix = +dotnet_naming_style.pascalcase.word_separator = +dotnet_naming_style.pascalcase.capitalization = pascal_case + +dotnet_naming_style.ipascalcase.required_prefix = I +dotnet_naming_style.ipascalcase.required_suffix = +dotnet_naming_style.ipascalcase.word_separator = +dotnet_naming_style.ipascalcase.capitalization = pascal_case + +dotnet_naming_style.tpascalcase.required_prefix = T +dotnet_naming_style.tpascalcase.required_suffix = +dotnet_naming_style.tpascalcase.word_separator = +dotnet_naming_style.tpascalcase.capitalization = pascal_case + +dotnet_naming_style._camelcase.required_prefix = _ +dotnet_naming_style._camelcase.required_suffix = +dotnet_naming_style._camelcase.word_separator = +dotnet_naming_style._camelcase.capitalization = camel_case + +dotnet_naming_style.camelcase.required_prefix = +dotnet_naming_style.camelcase.required_suffix = +dotnet_naming_style.camelcase.word_separator = +dotnet_naming_style.camelcase.capitalization = camel_case + +dotnet_naming_style.s_camelcase.required_prefix = s_ +dotnet_naming_style.s_camelcase.required_suffix = +dotnet_naming_style.s_camelcase.word_separator = +dotnet_naming_style.s_camelcase.capitalization = camel_case + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e41f00a --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +*.cache +*.dtbcache.v2 +*.pdb +*.suo +.suo +*.testlog +*.user +*.ide + +**/.vs/Release +**/.vs +**/obj/Debug +**/obj +obj/ +.vs/ +bin +Assemblies/**/*.dll \ No newline at end of file diff --git a/About/About.xml b/About/About.xml new file mode 100644 index 0000000..13a9253 --- /dev/null +++ b/About/About.xml @@ -0,0 +1,29 @@ + + + RimWorld font replacer + rapture.party + 1.2.0 + +
  • 1.4
  • +
  • 1.5
  • +
  • 1.6
  • +
    + https://git.rapture.party/rapture-party/rimworld-font-replacer + +
  • + brrainz.harmony + Harmony + steam://url/CommunityFilePage/2009463077 + https://github.com/pardeike/HarmonyRimWorld/releases/latest +
  • +
    + +
  • brrainz.harmony
  • +
    + raptureparty.rimworldfontreplacer + +Replace the default UI font of Arial (:nauseated_face:) with any font installed on your system. It can also change the font sizes. + +Note for Mac users: Unity's font loader is bugged and cannot load fonts installed under </System/Library/Fonts/Supplemental>. You can symlink or copy fonts installed here to </Library/Fonts> to access them. + +
    \ No newline at end of file diff --git a/About/preview.png b/About/preview.png new file mode 100644 index 0000000..cdbea42 Binary files /dev/null and b/About/preview.png differ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3c698a5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,11 @@ +Copyright 2026 rapture.party + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Languages/English/Keyed/Translations.xml b/Languages/English/Keyed/Translations.xml new file mode 100644 index 0000000..6cc11b6 --- /dev/null +++ b/Languages/English/Keyed/Translations.xml @@ -0,0 +1,18 @@ + + + Fonts + Choose Font + Font family + Font size + Tiny + Small + Medium + Planet + Not found + Unsupported + Choose {0} font + Current + Filter + Previews + Back in Jugust, we delivered oxygen equipment of the same size. 0123456789 $ + \ No newline at end of file diff --git a/Languages/Japanese/Keyed/Translations.xml b/Languages/Japanese/Keyed/Translations.xml new file mode 100644 index 0000000..8aaffa4 --- /dev/null +++ b/Languages/Japanese/Keyed/Translations.xml @@ -0,0 +1,18 @@ + + + フォント + フォントを選択 + フォントファミリー + フォントサイズ + 極小 + + + 惑星 + 見つかりません + 非対応 + {0}フォントを選択 + 現在 + 絞り込み + プレビュー + いろはにほへと ちりぬるを わかよたれそ 0123456789 $ + \ No newline at end of file diff --git a/LoadFolders.xml b/LoadFolders.xml new file mode 100644 index 0000000..6f00f8c --- /dev/null +++ b/LoadFolders.xml @@ -0,0 +1,14 @@ + + +
  • /
  • +
  • 1.4
  • +
    + +
  • /
  • +
  • 1.5
  • +
    + +
  • /
  • +
  • Current
  • +
    +
    \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6b5b248 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# RimWorld font replacer + +This mod allows you to replace the default RimWorld font of Arial (🤢) with any font installed on your system. + +## Dependencies + +- RimWorld 1.4+ +- Harmony ([GitHub](https://github.com/pardeike/HarmonyRimWorld), [Steam Workshop](https://steamcommunity.com/workshop/filedetails/?id=2009463077)) diff --git a/Source/CustomGUIStyles.cs b/Source/CustomGUIStyles.cs new file mode 100644 index 0000000..dbf06c8 --- /dev/null +++ b/Source/CustomGUIStyles.cs @@ -0,0 +1,121 @@ +using HarmonyLib; +using System.Reflection; +using Verse; +using UnityEngine; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace raptureparty.RimWorldFontReplacer +{ + [StaticConstructorOnStartup] + static class CustomGUIStyles + { + public static GUIStyle[] fontStyles; + + public static GUIStyle[] textFieldStyles; + + public static GUIStyle[] textAreaStyles; + + public static GUIStyle[] textAreaReadOnlyStyles; + + public static void UpdateFonts() + { + if (fontStyles != null) + { + fontStyles[0].font = FontLoader.FontTiny; + fontStyles[0].fontSize = FontLoader.FontTinySize; + fontStyles[1].font = FontLoader.FontSmall; + fontStyles[1].fontSize = FontLoader.FontSmallSize; + fontStyles[2].font = FontLoader.FontMedium; + fontStyles[2].fontSize = FontLoader.FontMediumSize; + } + if (textFieldStyles != null) + { + textFieldStyles[0].font = FontLoader.FontTiny; + textFieldStyles[0].fontSize = FontLoader.FontTinySize; + textFieldStyles[1].font = FontLoader.FontSmall; + textFieldStyles[1].fontSize = FontLoader.FontSmallSize; + textFieldStyles[2].font = FontLoader.FontMedium; + textFieldStyles[2].fontSize = FontLoader.FontMediumSize; + } + if (textAreaStyles != null) + { + textAreaStyles[0].font = FontLoader.FontTiny; + textAreaStyles[0].fontSize = FontLoader.FontTinySize; + textAreaStyles[1].font = FontLoader.FontSmall; + textAreaStyles[1].fontSize = FontLoader.FontSmallSize; + textAreaStyles[2].font = FontLoader.FontMedium; + textAreaStyles[2].fontSize = FontLoader.FontMediumSize; + } + if (textAreaReadOnlyStyles != null) + { + textAreaReadOnlyStyles[0].font = FontLoader.FontTiny; + textAreaReadOnlyStyles[0].fontSize = FontLoader.FontTinySize; + textAreaReadOnlyStyles[1].font = FontLoader.FontSmall; + textAreaReadOnlyStyles[1].fontSize = FontLoader.FontSmallSize; + textAreaReadOnlyStyles[2].font = FontLoader.FontMedium; + textAreaReadOnlyStyles[2].fontSize = FontLoader.FontMediumSize; + } + } + + public static void Create() + { + try + { + fontStyles = new GUIStyle[3]; + textFieldStyles = new GUIStyle[3]; + textAreaStyles = new GUIStyle[3]; + textAreaReadOnlyStyles = new GUIStyle[3]; + fontStyles[0] = new GUIStyle(GUI.skin.label); + fontStyles[0].font = FontLoader.FontTiny; + fontStyles[0].fontSize = FontLoader.FontTinySize; + fontStyles[1] = new GUIStyle(GUI.skin.label); + fontStyles[1].font = FontLoader.FontSmall; + fontStyles[1].fontSize = FontLoader.FontSmallSize; + fontStyles[1].contentOffset = new Vector2(0f, -1f); + fontStyles[2] = new GUIStyle(GUI.skin.label); + fontStyles[2].font = FontLoader.FontMedium; + fontStyles[2].fontSize = FontLoader.FontMediumSize; + for (int i = 0; i < textFieldStyles.Length; i++) + { + textFieldStyles[i] = new GUIStyle(GUI.skin.textField); + textFieldStyles[i].alignment = TextAnchor.MiddleLeft; + } + + textFieldStyles[0].font = FontLoader.FontTiny; + textFieldStyles[0].fontSize = FontLoader.FontTinySize; + textFieldStyles[1].font = FontLoader.FontSmall; + textFieldStyles[1].fontSize = FontLoader.FontSmallSize; + textFieldStyles[2].font = FontLoader.FontMedium; + textFieldStyles[2].fontSize = FontLoader.FontMediumSize; + for (int j = 0; j < textAreaStyles.Length; j++) + { + textAreaStyles[j] = new GUIStyle(textFieldStyles[j]) + { + fontSize = textFieldStyles[j].fontSize, + alignment = TextAnchor.UpperLeft, + wordWrap = true + }; + } + + for (int k = 0; k < textAreaReadOnlyStyles.Length; k++) + { + textAreaReadOnlyStyles[k] = new GUIStyle(textAreaStyles[k]); + textAreaReadOnlyStyles[k].fontSize = textAreaStyles[k].fontSize; + GUIStyle obj = textAreaReadOnlyStyles[k]; + obj.normal.background = null; + obj.active.background = null; + obj.onHover.background = null; + obj.hover.background = null; + obj.onFocused.background = null; + obj.focused.background = null; + } + } + catch (Exception ex) + { + Log.Message("Could not create GUI styles, " + ex.ToString()); + } + } + } +} diff --git a/Source/FontLoader.cs b/Source/FontLoader.cs new file mode 100644 index 0000000..764e8c7 --- /dev/null +++ b/Source/FontLoader.cs @@ -0,0 +1,110 @@ +using System; +using System.Linq; +using TMPro; +using UnityEngine; +using Verse; + +namespace raptureparty.RimWorldFontReplacer +{ + [StaticConstructorOnStartup] + class FontLoader + { + public static string TargetTinyFontName; + + public static string TargetSmallFontName; + + public static string TargetMediumFontName; + + public static string TargetPlanetFontName; + + public static int FontTinySize = 11; + + public static int FontSmallSize = 14; + + public static int FontMediumSize = 18; + + static private Font s_fontTiny; + static private string s_fontTinySearchedName; + static public bool FontTinyFound + { + get; private set; + } + + static private Font s_fontSmall; + static private string s_fontSmallSearchedName; + static public bool FontSmallFound + { + get; private set; + } + + static private Font s_fontMedium; + static private string s_fontMediumSearchedName; + static public bool FontMediumFound + { + get; private set; + } + + static private Font s_fontPlanet; + static private string s_fontPlanetSearchedName; + static public bool FontPlanetFound + { + get; private set; + } + + static public Font FontTiny + { + get + { + if (s_fontTinySearchedName != TargetTinyFontName) + { + s_fontTiny = Font.CreateDynamicFontFromOSFont(TargetTinyFontName, FontTinySize); + s_fontTinySearchedName = TargetTinyFontName; + FontTinyFound = Font.GetOSInstalledFontNames().Contains(TargetTinyFontName); + } + return FontTinyFound ? s_fontTiny : Text.fontStyles[0].font; + } + } + + static public Font FontSmall + { + get + { + if (s_fontSmallSearchedName != TargetSmallFontName) + { + s_fontSmall = Font.CreateDynamicFontFromOSFont(TargetSmallFontName, FontSmallSize); + s_fontSmallSearchedName = TargetSmallFontName; + FontSmallFound = Font.GetOSInstalledFontNames().Contains(TargetSmallFontName); + } + return FontSmallFound ? s_fontSmall : Text.fontStyles[1].font; + } + } + + static public Font FontMedium + { + get + { + if (s_fontMediumSearchedName != TargetMediumFontName) + { + s_fontMedium = Font.CreateDynamicFontFromOSFont(TargetMediumFontName, FontMediumSize); + s_fontMediumSearchedName = TargetMediumFontName; + FontMediumFound = Font.GetOSInstalledFontNames().Contains(TargetMediumFontName); ; + } + return FontMediumFound ? s_fontMedium : Text.fontStyles[2].font; + } + } + + static public Font FontPlanet + { + get + { + if (s_fontPlanetSearchedName != TargetPlanetFontName) + { + s_fontPlanet = Font.CreateDynamicFontFromOSFont(TargetPlanetFontName, Text.fontStyles[2].font.fontSize); // TODO: find correct size + s_fontPlanetSearchedName = TargetPlanetFontName; + FontPlanetFound = Font.GetOSInstalledFontNames().Contains(TargetPlanetFontName); ; + } + return FontPlanetFound ? s_fontPlanet : Text.fontStyles[2].font; // TODO: find correct size + } + } + } +} diff --git a/Source/FontPatches.cs b/Source/FontPatches.cs new file mode 100644 index 0000000..c3ca971 --- /dev/null +++ b/Source/FontPatches.cs @@ -0,0 +1,160 @@ +using HarmonyLib; +using System.Reflection; +using Verse; +using UnityEngine; +using System; +using System.Collections.Generic; +using System.Linq; +using RimWorld.Planet; +using TMPro; + +namespace raptureparty.RimWorldFontReplacer +{ + [HarmonyPatch] + static class Text_CurFontStyle_Patch + { + [HarmonyPatch(typeof(Text), nameof(Text.CurFontStyle), MethodType.Getter)] + public static bool Prefix(ref GUIStyle __result) + { + if (CustomGUIStyles.fontStyles == null) + { + CustomGUIStyles.Create(); + } + GUIStyle guistyle; + switch (Text.Font) + { + case GameFont.Tiny: + guistyle = CustomGUIStyles.fontStyles[0]; + break; + case GameFont.Small: + guistyle = CustomGUIStyles.fontStyles[1]; + break; + default: + case GameFont.Medium: + guistyle = CustomGUIStyles.fontStyles[2]; + break; + } + guistyle.alignment = Text.Anchor; + guistyle.wordWrap = Text.WordWrap; + __result = guistyle; + + return false; + } + } + + [HarmonyPatch] + static class Text_CurTextFieldStyle_Patch + { + [HarmonyPrefix] + [HarmonyPatch(typeof(Text), nameof(Text.CurTextFieldStyle), MethodType.Getter)] + static bool Prefix(ref GUIStyle __result) + { + if (CustomGUIStyles.fontStyles == null) + { + CustomGUIStyles.Create(); + } + GUIStyle guistyle; + switch (Text.Font) + { + case GameFont.Tiny: + guistyle = CustomGUIStyles.textFieldStyles[0]; + break; + case GameFont.Small: + guistyle = CustomGUIStyles.textFieldStyles[1]; + break; + default: + case GameFont.Medium: + guistyle = CustomGUIStyles.textFieldStyles[2]; + break; + } + __result = guistyle; + + return false; + } + } + + [HarmonyPatch] + static class Text_CurTextAreaStyle_Patch + { + [HarmonyPatch(typeof(Text), nameof(Text.CurTextAreaStyle), MethodType.Getter)] + static bool Prefix(ref GUIStyle __result) + { + if (CustomGUIStyles.fontStyles == null) + { + CustomGUIStyles.Create(); + } + GUIStyle guistyle; + switch (Text.Font) + { + case GameFont.Tiny: + guistyle = CustomGUIStyles.textAreaStyles[0]; + break; + case GameFont.Small: + guistyle = CustomGUIStyles.textAreaStyles[1]; + break; + default: + case GameFont.Medium: + guistyle = CustomGUIStyles.textAreaStyles[2]; + break; + } + __result = guistyle; + + return false; + } + } + + + [HarmonyPatch] + static class Text_CurTextAreaReadOnlyStyle_Patch + { + [HarmonyPatch(typeof(Text), nameof(Text.CurTextAreaReadOnlyStyle), MethodType.Getter)] + static bool Prefix(ref GUIStyle __result) + { + if (CustomGUIStyles.fontStyles == null) + { + CustomGUIStyles.Create(); + } + GUIStyle guistyle; + switch (Text.Font) + { + case GameFont.Tiny: + guistyle = CustomGUIStyles.textAreaReadOnlyStyles[0]; + break; + case GameFont.Small: + guistyle = CustomGUIStyles.textAreaReadOnlyStyles[1]; + break; + default: + case GameFont.Medium: + guistyle = CustomGUIStyles.textAreaReadOnlyStyles[2]; + break; + } + __result = guistyle; + + return false; + } + } + + [HarmonyPatch] + static class WorldFeatureTextMesh_TextMeshLegacy_Patch + { + [HarmonyPatch(typeof(WorldFeatureTextMesh_Legacy), nameof(WorldFeatureTextMesh_Legacy.Init))] + public static void Postfix(ref TextMesh ___textMesh) + { + Log.Message("Patching TextMesh init"); + ___textMesh.font = FontLoader.FontMedium; + } + } + + [HarmonyPatch] + static class WorldFeatureTextMesh_TextMeshPro_Patch + { + [HarmonyPatch(typeof(WorldFeatureTextMesh_TextMeshPro), nameof(WorldFeatureTextMesh_TextMeshPro.Init))] + public static void Postfix(ref TextMeshPro ___textMesh) + { + Log.Message("Patching TextMeshPro init"); + TMP_FontAsset asset = TMP_FontAsset.CreateFontAsset(FontLoader.FontPlanet); + ___textMesh.font = asset; + ___textMesh.UpdateFontAsset(); + } + } +} diff --git a/Source/Main.cs b/Source/Main.cs new file mode 100644 index 0000000..77ff44d --- /dev/null +++ b/Source/Main.cs @@ -0,0 +1,27 @@ +using HarmonyLib; +using System.Reflection; +using Verse; +using UnityEngine; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace raptureparty.RimWorldFontReplacer +{ + [StaticConstructorOnStartup] + class RimWorldFontReplacer : Mod + { + public RimWorldFontReplacer(ModContentPack content) : base(content) + { + base.GetSettings(); + var inst = new Harmony("rimworld.raptureparty.RimWorldFontReplacer"); + inst.PatchAll(); + } + + public void Save() => LoadedModManager.GetMod().GetSettings().Write(); + + public override string SettingsCategory() => "RimWorld Font Replacer"; + + public override void DoSettingsWindowContents(Rect inRect) => Settings.Build(inRect); + } +} diff --git a/Source/RimWorldFontReplacer.csproj b/Source/RimWorldFontReplacer.csproj new file mode 100644 index 0000000..0a78a94 --- /dev/null +++ b/Source/RimWorldFontReplacer.csproj @@ -0,0 +1,287 @@ + + + net472 + False + False + ../Assemblies/Current + false + None + + + + + /Applications/RimWorld.app/Contents/Resources/Data/Managed + /Applications/RimWorld.app/Mods/HarmonyMod/Current/Assemblies + + + + $(HarmonyAssemblies)/0Harmony.dll + False + + + $(RimWorldManaged)\Assembly-CSharp.dll + False + + + + + + + + + $(RimWorldManaged)\Unity.TextMeshPro.dll + False + + + $(RimWorldManaged)\UnityEngine.dll + False + + + $(RimWorldManaged)\UnityEngine.AccessibilityModule.dll + False + + + $(RimWorldManaged)\UnityEngine.AIModule.dll + False + + + $(RimWorldManaged)\UnityEngine.AndroidJNIModule.dll + False + + + $(RimWorldManaged)\UnityEngine.AnimationModule.dll + False + + + $(RimWorldManaged)\UnityEngine.ARModule.dll + False + + + $(RimWorldManaged)\UnityEngine.AssetBundleModule.dll + False + + + $(RimWorldManaged)\UnityEngine.AudioModule.dll + False + + + $(RimWorldManaged)\UnityEngine.ClothModule.dll + False + + + $(RimWorldManaged)\UnityEngine.ClusterInputModule.dll + False + + + $(RimWorldManaged)\UnityEngine.ClusterRendererModule.dll + False + + + $(RimWorldManaged)\UnityEngine.CoreModule.dll + False + + + $(RimWorldManaged)\UnityEngine.CrashReportingModule.dll + False + + + $(RimWorldManaged)\UnityEngine.DirectorModule.dll + False + + + $(RimWorldManaged)\UnityEngine.DSPGraphModule.dll + False + + + $(RimWorldManaged)\UnityEngine.GameCenterModule.dll + False + + + $(RimWorldManaged)\UnityEngine.GridModule.dll + False + + + $(RimWorldManaged)\UnityEngine.HotReloadModule.dll + False + + + $(RimWorldManaged)\UnityEngine.ImageConversionModule.dll + False + + + $(RimWorldManaged)\UnityEngine.IMGUIModule.dll + False + + + $(RimWorldManaged)\UnityEngine.InputLegacyModule.dll + False + + + $(RimWorldManaged)\UnityEngine.InputModule.dll + False + + + $(RimWorldManaged)\UnityEngine.JSONSerializeModule.dll + False + + + $(RimWorldManaged)\UnityEngine.LocalizationModule.dll + False + + + $(RimWorldManaged)\UnityEngine.ParticleSystemModule.dll + False + + + $(RimWorldManaged)\UnityEngine.PerformanceReportingModule.dll + False + + + $(RimWorldManaged)\UnityEngine.Physics2DModule.dll + False + + + $(RimWorldManaged)\UnityEngine.PhysicsModule.dll + False + + + $(RimWorldManaged)\UnityEngine.ProfilerModule.dll + False + + + $(RimWorldManaged)\UnityEngine.ScreenCaptureModule.dll + False + + + $(RimWorldManaged)\UnityEngine.SharedInternalsModule.dll + False + + + $(RimWorldManaged)\UnityEngine.SpriteMaskModule.dll + False + + + $(RimWorldManaged)\UnityEngine.SpriteShapeModule.dll + False + + + $(RimWorldManaged)\UnityEngine.StreamingModule.dll + False + + + $(RimWorldManaged)\UnityEngine.SubstanceModule.dll + False + + + $(RimWorldManaged)\UnityEngine.TerrainModule.dll + False + + + $(RimWorldManaged)\UnityEngine.TerrainPhysicsModule.dll + False + + + $(RimWorldManaged)\UnityEngine.TextRenderingModule.dll + False + + + $(RimWorldManaged)\UnityEngine.TilemapModule.dll + False + + + $(RimWorldManaged)\UnityEngine.TLSModule.dll + False + + + $(RimWorldManaged)\UnityEngine.UI.dll + False + + + $(RimWorldManaged)\UnityEngine.UIElementsModule.dll + False + + + $(RimWorldManaged)\UnityEngine.UIModule.dll + False + + + $(RimWorldManaged)\UnityEngine.UmbraModule.dll + False + + + $(RimWorldManaged)\UnityEngine.UnityAnalyticsModule.dll + False + + + $(RimWorldManaged)\UnityEngine.UnityConnectModule.dll + False + + + $(RimWorldManaged)\UnityEngine.UnityTestProtocolModule.dll + False + + + $(RimWorldManaged)\UnityEngine.UnityWebRequestAssetBundleModule.dll + False + + + $(RimWorldManaged)\UnityEngine.UnityWebRequestAudioModule.dll + False + + + $(RimWorldManaged)\UnityEngine.UnityWebRequestModule.dll + False + + + $(RimWorldManaged)\UnityEngine.UnityWebRequestTextureModule.dll + False + + + $(RimWorldManaged)\UnityEngine.UnityWebRequestWWWModule.dll + False + + + $(RimWorldManaged)\UnityEngine.VehiclesModule.dll + False + + + $(RimWorldManaged)\UnityEngine.VFXModule.dll + False + + + $(RimWorldManaged)\UnityEngine.VideoModule.dll + False + + + $(RimWorldManaged)\UnityEngine.VRModule.dll + False + + + $(RimWorldManaged)\UnityEngine.WindModule.dll + False + + + $(RimWorldManaged)\UnityEngine.XRModule.dll + False + + + + + + + + + + + + + + + + + + diff --git a/Source/Settings.cs b/Source/Settings.cs new file mode 100644 index 0000000..9ce7dfa --- /dev/null +++ b/Source/Settings.cs @@ -0,0 +1,257 @@ +using UnityEngine; +using Verse; +using System; +using HarmonyLib; +using System.Collections.Generic; +using System.Reflection; +using UnityEngine.UI; +using System.IO; + +namespace raptureparty.RimWorldFontReplacer +{ + + public class FontListDialog : Window + { + protected Vector2 scrollPosition = Vector2.zero; + + protected string[] _fonts = new string[0]; + + protected float bottomAreaHeight; + + protected string _filterText = ""; + + private string _prevFilterText = null; + + public uint FontIndex = 0; + + public FontListDialog() + { + doCloseButton = true; + doCloseX = true; + forcePause = true; + absorbInputAroundWindow = true; + closeOnAccept = false; + } + + public override void PreOpen() + { + base.PreOpen(); + _fonts = Font.GetOSInstalledFontNames(); + } + + public override void PostClose() + { + base.PostClose(); + } + + private string CurrentFontName + { + get + { + switch (FontIndex) + { + case 0: return FontLoader.TargetTinyFontName; + case 1: return FontLoader.TargetSmallFontName; + case 2: return FontLoader.TargetMediumFontName; + case 3: return FontLoader.TargetPlanetFontName; + default: return ""; + } + } + } + + private string FontTypeLabel + { + get + { + switch (FontIndex) + { + case 0: return "RWFR.Tiny".Translate(); + case 1: return "RWFR.Small".Translate(); + case 2: return "RWFR.Medium".Translate(); + case 3: return "RWFR.Planet".Translate(); + default: return ""; + } + } + } + + public override void DoWindowContents(Rect inRect) + { + float y = inRect.y; + + // Title + Verse.Text.Font = GameFont.Medium; + Widgets.Label(new Rect(inRect.x, y, inRect.width, 32f), "RWFR.ChooseFont_For".Translate(FontTypeLabel)); + Verse.Text.Font = GameFont.Small; + y += 36f; + + // Current selection + string current = CurrentFontName; + if (!string.IsNullOrEmpty(current)) + { + GUI.color = new Color(0.7f, 0.7f, 0.7f); + Widgets.Label(new Rect(inRect.x, y, inRect.width, 24f), "RWFR.Current".Translate() + ": " + current); + GUI.color = Color.white; + y += 26f; + } + + // Filter box + Widgets.Label(new Rect(inRect.x, y + 2f, 60f, 28f), "RWFR.Filter".Translate()); + string newFilter = Widgets.TextField(new Rect(inRect.x + 64f, y, inRect.width - 64f, 28f), _filterText); + if (newFilter != _prevFilterText) + { + scrollPosition = Vector2.zero; + _prevFilterText = newFilter; + } + _filterText = newFilter; + y += 34f; + + // Build filtered list + string[] filtered = string.IsNullOrEmpty(_filterText) + ? _fonts + : System.Array.FindAll(_fonts, f => f.IndexOf(_filterText, StringComparison.OrdinalIgnoreCase) >= 0); + + float listHeight = filtered.Length * 36f; + Rect outRect = new Rect(inRect.x, y, inRect.width, inRect.height - (y - inRect.y) - bottomAreaHeight - 50f); + Rect viewRect = new Rect(0f, 0f, outRect.width - 16f, listHeight); + + Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect, true); + + for (int i = 0; i < filtered.Length; i++) + { + bool isSelected = filtered[i] == current; + if (isSelected) + GUI.color = new Color(0.8f, 1f, 0.8f); + + if (Widgets.ButtonText(new Rect(0f, i * 36f, viewRect.width, 26f), filtered[i])) + { + switch (FontIndex) + { + case 0: FontLoader.TargetTinyFontName = filtered[i]; break; + case 1: FontLoader.TargetSmallFontName = filtered[i]; break; + case 2: FontLoader.TargetMediumFontName = filtered[i]; break; + case 3: FontLoader.TargetPlanetFontName = filtered[i]; break; + } + Close(); + } + + if (isSelected) + GUI.color = Color.white; + } + + Widgets.EndScrollView(); + } + } + + class Settings : ModSettings + { + public static Vector2 scrollPosition = Vector2.zero; + + private static string s_fontTinySizeBuffer = FontLoader.FontTinySize.ToString(); + private static string s_fontSmallSizeBuffer = FontLoader.FontSmallSize.ToString(); + private static string s_fontMediumSizeBuffer = FontLoader.FontMediumSize.ToString(); + + public static void Build(Rect inRect) + { + + inRect.yMin += 15f; + inRect.yMax -= 15f; + + var defaultColumnWidth = inRect.width - 50; + Listing_Standard list = new Listing_Standard() { ColumnWidth = defaultColumnWidth }; + + var outRect = new Rect(inRect.x, inRect.y, inRect.width, inRect.height); + var scrollRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + 200); + Widgets.BeginScrollView(outRect, ref scrollPosition, scrollRect, true); + + list.Begin(scrollRect); + + list.Label("RWFR.Fonts".Translate()); + list.GapLine(); + + list.Label("RWFR.Tiny".Translate()); + list.Indent(); + FontLoader.TargetTinyFontName = list.TextEntryLabeled("RWFR.Font_family".Translate(), FontLoader.TargetTinyFontName, 1); + list.TextFieldNumericLabeled("RWFR.Font_size".Translate(), ref FontLoader.FontTinySize, ref s_fontTinySizeBuffer, 1); + if (list.ButtonTextLabeled("", "RWFR.ChooseFont".Translate())) + { + var selector = new FontListDialog { FontIndex = 0 }; + Find.WindowStack.Add(selector); + } + list.Label(FontLoader.FontTinyFound ? "" : (string)"RWFR.Not_found".Translate()); + list.Outdent(); + + list.Label("RWFR.Small".Translate()); + list.Indent(); + FontLoader.TargetSmallFontName = list.TextEntryLabeled("RWFR.Font_family".Translate(), FontLoader.TargetSmallFontName, 1); + list.TextFieldNumericLabeled("RWFR.Font_size".Translate(), ref FontLoader.FontSmallSize, ref s_fontSmallSizeBuffer, 1); + if (list.ButtonTextLabeled("", "RWFR.ChooseFont".Translate())) + { + var selector = new FontListDialog { FontIndex = 1 }; + Find.WindowStack.Add(selector); + } + list.Label(FontLoader.FontSmallFound ? "" : (string)"RWFR.Not_found".Translate()); + list.Outdent(); + + list.Label("RWFR.Medium".Translate()); + list.Indent(); + FontLoader.TargetMediumFontName = list.TextEntryLabeled("RWFR.Font_family".Translate(), FontLoader.TargetMediumFontName, 1); + list.TextFieldNumericLabeled("RWFR.Font_size".Translate(), ref FontLoader.FontMediumSize, ref s_fontMediumSizeBuffer, 1); + if (list.ButtonTextLabeled("", "RWFR.ChooseFont".Translate())) + { + var selector = new FontListDialog { FontIndex = 2 }; + Find.WindowStack.Add(selector); + } + list.Label(FontLoader.FontMediumFound ? "" : (string)"RWFR.Not_found".Translate()); + list.Outdent(); + + list.Gap(12f); + list.Label("RWFR.Previews".Translate()); + list.GapLine(); + + string previewText = "RWFR.Preview_text".Translate(); + + list.Label("RWFR.Tiny".Translate(), 28f); + list.Indent(); + if (CustomGUIStyles.fontStyles != null) + { + float h = Mathf.Max(FontLoader.FontTinySize, 12) + 10f; + GUI.Label(list.GetRect(h), previewText, CustomGUIStyles.fontStyles[0]); + } + list.Outdent(); + + list.Label("RWFR.Small".Translate(), 28f); + list.Indent(); + if (CustomGUIStyles.fontStyles != null) + { + float h = Mathf.Max(FontLoader.FontSmallSize, 12) + 10f; + GUI.Label(list.GetRect(h), previewText, CustomGUIStyles.fontStyles[1]); + } + list.Outdent(); + + list.Label("RWFR.Medium".Translate(), 28f); + list.Indent(); + if (CustomGUIStyles.fontStyles != null) + { + float h = Mathf.Max(FontLoader.FontMediumSize, 12) + 10f; + GUI.Label(list.GetRect(h), previewText, CustomGUIStyles.fontStyles[2]); + } + list.Outdent(); + + list.End(); + Widgets.EndScrollView(); + CustomGUIStyles.UpdateFonts(); + } + + public override void ExposeData() + { + base.ExposeData(); + Scribe_Values.Look(ref FontLoader.FontTinySize, "fontSizeTiny", 11); + Scribe_Values.Look(ref FontLoader.FontSmallSize, "fontSizeSmall", 14); + Scribe_Values.Look(ref FontLoader.FontMediumSize, "fontSizeMedium", 18); + Scribe_Values.Look(ref FontLoader.TargetTinyFontName, "fontNameTiny", "Helvetica"); + Scribe_Values.Look(ref FontLoader.TargetSmallFontName, "fontNameSmall", "Helvetica"); + Scribe_Values.Look(ref FontLoader.TargetMediumFontName, "fontNameMedium", "Helvetica"); + Scribe_Values.Look(ref FontLoader.TargetPlanetFontName, "fontNamePlanet", "Helvetica"); + } + } +} diff --git a/omnisharp.json b/omnisharp.json new file mode 100644 index 0000000..b29cc87 --- /dev/null +++ b/omnisharp.json @@ -0,0 +1,17 @@ +{ + "fileOptions": { + "systemExcludeSearchPatterns": [ + "**/node_modules/**/*", + "**/bin/**/*", + "**/obj/**/*" + ], + "excludeSearchPatterns": [] + }, + "msbuild": { + "enabled": true + }, + "FormattingOptions": { + "EnableEditorConfigSupport": true, + "OrganizeImports": true + } +} \ No newline at end of file diff --git a/rimworld-font-replacer.sln b/rimworld-font-replacer.sln new file mode 100644 index 0000000..6b85ce9 --- /dev/null +++ b/rimworld-font-replacer.sln @@ -0,0 +1,39 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{B8EFCA5F-814F-285C-A8CB-F00F14650265}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RimWorldFontReplacer", "Source\RimWorldFontReplacer.csproj", "{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|x64.ActiveCfg = Debug|Any CPU + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|x64.Build.0 = Debug|Any CPU + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|x86.ActiveCfg = Debug|Any CPU + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|x86.Build.0 = Debug|Any CPU + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|Any CPU.Build.0 = Release|Any CPU + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|x64.ActiveCfg = Release|Any CPU + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|x64.Build.0 = Release|Any CPU + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|x86.ActiveCfg = Release|Any CPU + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {FEDB45A9-FE14-4856-BEC0-0FF75B120BE6} = {B8EFCA5F-814F-285C-A8CB-F00F14650265} + EndGlobalSection +EndGlobal