diff --git a/fonts/ingame/FantasqueSansMono-Bold.ttf b/fonts/ingame/FantasqueSansMono-Bold.ttf new file mode 100644 index 00000000..b1b07f60 Binary files /dev/null and b/fonts/ingame/FantasqueSansMono-Bold.ttf differ diff --git a/fonts/ingame/FantasqueSansMono-Regular.ttf b/fonts/ingame/FantasqueSansMono-Regular.ttf new file mode 100644 index 00000000..fa6be4d8 Binary files /dev/null and b/fonts/ingame/FantasqueSansMono-Regular.ttf differ diff --git a/fonts/ingame/Hack-Bold.ttf b/fonts/ingame/Hack-Bold.ttf new file mode 100644 index 00000000..7ff49752 Binary files /dev/null and b/fonts/ingame/Hack-Bold.ttf differ diff --git a/fonts/ingame/Hack-Regular.ttf b/fonts/ingame/Hack-Regular.ttf new file mode 100644 index 00000000..92a90cb0 Binary files /dev/null and b/fonts/ingame/Hack-Regular.ttf differ diff --git a/fonts/ingame/Inconsolata-LGC-Bold.ttf b/fonts/ingame/Inconsolata-LGC-Bold.ttf new file mode 100644 index 00000000..bf714644 Binary files /dev/null and b/fonts/ingame/Inconsolata-LGC-Bold.ttf differ diff --git a/fonts/ingame/Inconsolata-LGC.ttf b/fonts/ingame/Inconsolata-LGC.ttf new file mode 100644 index 00000000..cdc366b5 Binary files /dev/null and b/fonts/ingame/Inconsolata-LGC.ttf differ diff --git a/fonts/ingame/PT_Mono_55F.ttf b/fonts/ingame/PT_Mono_55F.ttf new file mode 100644 index 00000000..547ebcef Binary files /dev/null and b/fonts/ingame/PT_Mono_55F.ttf differ diff --git a/fonts/ingame/PT_Mono_75F.ttf b/fonts/ingame/PT_Mono_75F.ttf new file mode 100644 index 00000000..00429526 Binary files /dev/null and b/fonts/ingame/PT_Mono_75F.ttf differ diff --git a/fonts/ingame/UbuntuMono-B.ttf b/fonts/ingame/UbuntuMono-B.ttf new file mode 100644 index 00000000..7bd66657 Binary files /dev/null and b/fonts/ingame/UbuntuMono-B.ttf differ diff --git a/fonts/ingame/UbuntuMono-R.ttf b/fonts/ingame/UbuntuMono-R.ttf new file mode 100644 index 00000000..fdd309d7 Binary files /dev/null and b/fonts/ingame/UbuntuMono-R.ttf differ diff --git a/fonts/ingame/font_info.json b/fonts/ingame/font_info.json new file mode 100644 index 00000000..da222898 --- /dev/null +++ b/fonts/ingame/font_info.json @@ -0,0 +1,72 @@ +[ + { + "name": "Fantasque Sans Mono", + "file": "FantasqueSansMono-Regular.ttf", + "desc": "A somewhat whimsical monospace font by Jany Belluz.", + "height": 1.0, + "width": 0.5, + }, + { + "name": "Fantasque Sans Mono Bold", + "file": "FantasqueSansMono-Bold.ttf", + "desc": "A somewhat whimsical monospace font by Jany Belluz.", + "height": 1.0, + "width": 0.5, + }, + { + "name": "Hack", + "file": "Hack-Regular.ttf", + "desc": "A workhorse font primarily designed for source code,\nwith focus on legibility. By Source Foundry Authors.", + "height": 1.2, + "width": 0.55, + }, + { + "name": "Hack Bold", + "file": "Hack-Bold.ttf", + "desc": "A workhorse font primarily designed for source code,\nwith focus on legibility. By Source Foundry Authors.", + "height": 1.2, + "width": 0.55, + }, + { + "name": "Inconsolata LGC", + "file": "Inconsolata-LGC.ttf", + "desc": "A variant of Inconsolata font (originally by Raph Levien)\nwith addition of Greek and Cyrillic characters.", + "height": 1.25, + "width": 0.6, + }, + { + "name": "Inconsolata LGC Bold", + "file": "Inconsolata-LGC-Bold.ttf", + "desc": "A variant of Inconsolata font (originally by Raph Levien)\nwith addition of Greek and Cyrillic characters.", + "height": 1.25, + "width": 0.6, + }, + { + "name": "PT Mono 55F", + "file": "PT_Mono_55F.ttf", + "desc": "A typewriter font by ParaType with excellent Cyrillic typography.", + "height": 1.2, + "width": 0.6, + }, + { + "name": "PT Mono 75F", + "file": "PT_Mono_75F.ttf", + "desc": "A typewriter font by ParaType with excellent Cyrillic typography.", + "height": 1.2, + "width": 0.6, + }, + { + "name": "Ubuntu Mono", + "file": "UbuntuMono-R.ttf", + "desc": "A font by Canonical with a very distinct style,\ndesigned for the eponymous Linux distribution.", + "height": 1.1, + "width": 0.5, + }, + { + "name": "Ubuntu Mono Bold", + "file": "UbuntuMono-B.ttf", + "desc": "A font by Canonical with a very distinct style,\ndesigned for the eponymous Linux distribution.", + "height": 1.1, + "width": 0.5, + }, +] diff --git a/fonts/licenses/FantasqueSansMono.txt b/fonts/licenses/FantasqueSansMono.txt new file mode 100644 index 00000000..af9106f5 --- /dev/null +++ b/fonts/licenses/FantasqueSansMono.txt @@ -0,0 +1,93 @@ +Copyright (c) 2013-2017, Jany Belluz (jany.belluz@hotmail.fr) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/fonts/licenses/Hack.txt b/fonts/licenses/Hack.txt new file mode 100644 index 00000000..6f20f204 --- /dev/null +++ b/fonts/licenses/Hack.txt @@ -0,0 +1,45 @@ +The work in the Hack project is Copyright 2018 Source Foundry Authors and licensed under the MIT License + +The work in the DejaVu project was committed to the public domain. + +Bitstream Vera Sans Mono Copyright 2003 Bitstream Inc. and licensed under the Bitstream Vera License with Reserved Font Names "Bitstream" and "Vera" + +MIT License + +Copyright (c) 2018 Source Foundry Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +BITSTREAM VERA LICENSE + +Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: + +The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces. + +The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera". + +This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names. + +The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. + +Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org. diff --git a/fonts/licenses/Inconsolata-LGC.txt b/fonts/licenses/Inconsolata-LGC.txt new file mode 100644 index 00000000..26b5b734 --- /dev/null +++ b/fonts/licenses/Inconsolata-LGC.txt @@ -0,0 +1,95 @@ +Copyright (c) 2006, Raph Levien. +Copyright (c) 2010-2012, Dimosthenis Kaponis. +Copyright (c) 2012, MihailJP. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/fonts/OPENSANS_LICENSE b/fonts/licenses/OpenSans.txt similarity index 100% rename from fonts/OPENSANS_LICENSE rename to fonts/licenses/OpenSans.txt diff --git a/fonts/licenses/PT_Mono.txt b/fonts/licenses/PT_Mono.txt new file mode 100644 index 00000000..c3dadb95 --- /dev/null +++ b/fonts/licenses/PT_Mono.txt @@ -0,0 +1,44 @@ +Copyright (c) 2009, ParaType Ltd. All Rights Reserved. + +LICENSING AGREEMENT +for the fonts with Original Name: PT Sans, PT Serif, PT Mono. +Version 1.3 - January 20, 2012 + +GRANT OF LICENSE +ParaType Ltd grants you the right to use, copy, modify the fonts and distribute +modified and unmodified copies of the fonts by any means, including placing +on Web servers for free downloading, embedding in documents and Web pages, +bundling with commercial and non commercial products, if it does not conflict +with the conditions listed below: + +- You may bundle the font with commercial software, but you may not sell the +fonts by themselves. They are free. + +- You may distribute the fonts in modified or unmodified version only together +with this Licensing Agreement and with above copyright notice. You have no +right to modify the text of Licensing Agreement. It can be placed in a separate +text file or inserted into the font file, but it must be easily viewed by users. + +- You may not distribute modified version of the font under the Original name +or combination of Original name with any other words without explicit written +permission from ParaType. + +TERMINATION & TERRITORY +This license has no limits on time and territory, but it becomes null and void +if any of the above conditions are not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, +OR OTHER RIGHT. IN NO EVENT SHALL PARATYPE BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, +INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER +DEALINGS IN THE FONT SOFTWARE. + +ParaType Ltd +http://www.paratype.ru + diff --git a/fonts/licenses/UbuntuMono.txt b/fonts/licenses/UbuntuMono.txt new file mode 100644 index 00000000..29a19706 --- /dev/null +++ b/fonts/licenses/UbuntuMono.txt @@ -0,0 +1,101 @@ +Copyright 2010,2011 Canonical Ltd. + +This Font Software is licensed under the Ubuntu Font Licence, Version +1.0. https://launchpad.net/ubuntu-font-licence + +------------------------------- +UBUNTU FONT LICENCE Version 1.0 +------------------------------- + +PREAMBLE +This licence allows the licensed fonts to be used, studied, modified and +redistributed freely. The fonts, including any derivative works, can be +bundled, embedded, and redistributed provided the terms of this licence +are met. The fonts and derivatives, however, cannot be released under +any other licence. The requirement for fonts to remain under this +licence does not require any document created using the fonts or their +derivatives to be published under this licence, as long as the primary +purpose of the document is not to be a vehicle for the distribution of +the fonts. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this licence and clearly marked as such. This may +include source files, build scripts and documentation. + +"Original Version" refers to the collection of Font Software components +as received under this licence. + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to +a new environment. + +"Copyright Holder(s)" refers to all individuals and companies who have a +copyright ownership of the Font Software. + +"Substantially Changed" refers to Modified Versions which can be easily +identified as dissimilar to the Font Software by users of the Font +Software comparing the Original Version with the Modified Version. + +To "Propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification and with or without charging +a redistribution fee), making available to the public, and in some +countries other activities as well. + +PERMISSION & CONDITIONS +This licence does not grant any rights under trademark law and all such +rights are reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of the Font Software, to propagate the Font Software, subject to +the below conditions: + +1) Each copy of the Font Software must contain the above copyright +notice and this licence. These can be included either as stand-alone +text files, human-readable headers or in the appropriate machine- +readable metadata fields within text or binary files as long as those +fields can be easily viewed by the user. + +2) The font name complies with the following: +(a) The Original Version must retain its name, unmodified. +(b) Modified Versions which are Substantially Changed must be renamed to +avoid use of the name of the Original Version or similar names entirely. +(c) Modified Versions which are not Substantially Changed must be +renamed to both (i) retain the name of the Original Version and (ii) add +additional naming elements to distinguish the Modified Version from the +Original Version. The name of such Modified Versions must be the name of +the Original Version, with "derivative X" where X represents the name of +the new work, appended to that name. + +3) The name(s) of the Copyright Holder(s) and any contributor to the +Font Software shall not be used to promote, endorse or advertise any +Modified Version, except (i) as required by this licence, (ii) to +acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with +their explicit written permission. + +4) The Font Software, modified or unmodified, in part or in whole, must +be distributed entirely under this licence, and must not be distributed +under any other licence. The requirement for fonts to remain under this +licence does not affect any document created using the Font Software, +except any version of the Font Software extracted from a document +created using the Font Software may only be distributed under this +licence. + +TERMINATION +This licence becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER +DEALINGS IN THE FONT SOFTWARE. diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 9b171b4d..8144212f 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=28 format=2] +[gd_scene load_steps=30 format=2] [ext_resource path="res://icons/info.svg" type="Texture" id=1] [ext_resource path="res://icons/download.svg" type="Texture" id=2] @@ -26,6 +26,8 @@ [ext_resource path="res://fonts/OpenSans-SemiboldItalic.tres" type="DynamicFont" id=24] [ext_resource path="res://icons/folder.svg" type="Texture" id=25] [ext_resource path="res://scenes/InlineIconButton.tscn" type="PackedScene" id=26] +[ext_resource path="res://scripts/FontsUI.gd" type="Script" id=27] +[ext_resource path="res://scripts/FontManager.gd" type="Script" id=28] [sub_resource type="ButtonGroup" id=1] @@ -583,6 +585,241 @@ filters = PoolStringArray( "*.zip" ) current_dir = "/mnt/data/Godot/Catapult/Project" current_path = "/mnt/data/Godot/Catapult/Project/" +[node name="Fonts" type="VBoxContainer" parent="Main/Tabs"] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 7.5 +margin_top = 38.5 +margin_right = -7.5 +margin_bottom = -7.5 +script = ExtResource( 27 ) + +[node name="FontSelection" type="HBoxContainer" parent="Main/Tabs/Fonts"] +margin_right = 769.0 +margin_bottom = 428.0 + +[node name="RightPane" type="VBoxContainer" parent="Main/Tabs/Fonts/FontSelection"] +margin_right = 299.0 +margin_bottom = 428.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 2.0 + +[node name="Label" type="Label" parent="Main/Tabs/Fonts/FontSelection/RightPane"] +margin_left = 108.0 +margin_right = 191.0 +margin_bottom = 29.0 +size_flags_horizontal = 4 +text = "Available:" +align = 1 + +[node name="FontsList" type="ItemList" parent="Main/Tabs/Fonts/FontSelection/RightPane"] +margin_top = 35.0 +margin_right = 299.0 +margin_bottom = 285.0 +rect_min_size = Vector2( 0, 250 ) +size_flags_stretch_ratio = 2.0 +items = [ "Item 0", null, false, "Item 1", null, false, "Item 2", null, false, "Item 3", null, false ] +allow_reselect = true + +[node name="Buttons" type="VBoxContainer" parent="Main/Tabs/Fonts/FontSelection/RightPane"] +margin_top = 310.0 +margin_right = 299.0 +margin_bottom = 409.0 +size_flags_vertical = 6 + +[node name="Grid" type="GridContainer" parent="Main/Tabs/Fonts/FontSelection/RightPane/Buttons"] +margin_left = 23.0 +margin_right = 276.0 +margin_bottom = 64.0 +size_flags_horizontal = 4 +columns = 2 + +[node name="BtnSetFontUI" type="Button" parent="Main/Tabs/Fonts/FontSelection/RightPane/Buttons/Grid"] +margin_right = 142.0 +margin_bottom = 29.0 +text = "Set for Game UI" + +[node name="BtnSetFontMap" type="Button" parent="Main/Tabs/Fonts/FontSelection/RightPane/Buttons/Grid"] +margin_left = 148.0 +margin_right = 253.0 +margin_bottom = 29.0 +text = "Set for Map" + +[node name="BtnSetFontOvermap" type="Button" parent="Main/Tabs/Fonts/FontSelection/RightPane/Buttons/Grid"] +margin_top = 35.0 +margin_right = 142.0 +margin_bottom = 64.0 +text = "Set for Overmap" + +[node name="BtnSetFontAll" type="Button" parent="Main/Tabs/Fonts/FontSelection/RightPane/Buttons/Grid"] +margin_left = 148.0 +margin_top = 35.0 +margin_right = 253.0 +margin_bottom = 64.0 +text = "Set for All" + +[node name="BtnResetFont" type="Button" parent="Main/Tabs/Fonts/FontSelection/RightPane/Buttons"] +margin_left = 85.0 +margin_top = 70.0 +margin_right = 213.0 +margin_bottom = 99.0 +size_flags_horizontal = 4 +text = "Reset All Fonts" + +[node name="VSeparator" type="VSeparator" parent="Main/Tabs/Fonts/FontSelection"] +margin_left = 305.0 +margin_right = 313.0 +margin_bottom = 428.0 + +[node name="LeftPane" type="VBoxContainer" parent="Main/Tabs/Fonts/FontSelection"] +margin_left = 319.0 +margin_right = 769.0 +margin_bottom = 428.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 3.0 +custom_constants/separation = 4 + +[node name="Label" type="Label" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] +margin_left = 187.0 +margin_right = 262.0 +margin_bottom = 29.0 +size_flags_horizontal = 4 +text = "Preview:" +align = 1 + +[node name="Preview" type="RichTextLabel" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] +margin_top = 33.0 +margin_right = 450.0 +margin_bottom = 193.0 +rect_min_size = Vector2( 0, 160 ) +custom_constants/line_separation = -2 +bbcode_enabled = true +bbcode_text = "This text is for font preview." +text = "This text is for font preview." + +[node name="PreviewCyrillic" type="CheckBox" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] +margin_left = 109.0 +margin_top = 197.0 +margin_right = 340.0 +margin_bottom = 226.0 +size_flags_horizontal = 4 +text = "Preview Cyrillic characters" + +[node name="HSeparator" type="HSeparator" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] +margin_top = 230.0 +margin_right = 450.0 +margin_bottom = 230.0 +custom_constants/separation = 0 + +[node name="Label2" type="Label" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] +margin_left = 145.0 +margin_top = 234.0 +margin_right = 304.0 +margin_bottom = 263.0 +size_flags_horizontal = 4 +text = "Other font settings:" +align = 1 + +[node name="FontSizeUI" type="HBoxContainer" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] +margin_top = 267.0 +margin_right = 450.0 +margin_bottom = 296.0 +size_flags_vertical = 6 + +[node name="Label" type="Label" parent="Main/Tabs/Fonts/FontSelection/LeftPane/FontSizeUI"] +margin_right = 99.0 +margin_bottom = 29.0 +text = "UI font size:" + +[node name="sbFontSizeUI" type="SpinBox" parent="Main/Tabs/Fonts/FontSelection/LeftPane/FontSizeUI"] +margin_left = 320.0 +margin_right = 450.0 +margin_bottom = 29.0 +size_flags_horizontal = 10 +min_value = 8.0 +max_value = 64.0 +value = 8.0 + +[node name="FontSizeMap" type="HBoxContainer" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] +margin_top = 300.0 +margin_right = 450.0 +margin_bottom = 329.0 +size_flags_vertical = 6 + +[node name="Label" type="Label" parent="Main/Tabs/Fonts/FontSelection/LeftPane/FontSizeMap"] +margin_right = 116.0 +margin_bottom = 29.0 +text = "Map font size:" + +[node name="sbFontSizeMap" type="SpinBox" parent="Main/Tabs/Fonts/FontSelection/LeftPane/FontSizeMap"] +margin_left = 320.0 +margin_right = 450.0 +margin_bottom = 29.0 +size_flags_horizontal = 10 +min_value = 8.0 +max_value = 64.0 +value = 8.0 + +[node name="FontSizeOvermap" type="HBoxContainer" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] +margin_top = 333.0 +margin_right = 450.0 +margin_bottom = 362.0 +size_flags_vertical = 6 + +[node name="Label" type="Label" parent="Main/Tabs/Fonts/FontSelection/LeftPane/FontSizeOvermap"] +margin_right = 153.0 +margin_bottom = 29.0 +text = "Overmap font size:" + +[node name="sbFontSizeOM" type="SpinBox" parent="Main/Tabs/Fonts/FontSelection/LeftPane/FontSizeOvermap"] +margin_left = 320.0 +margin_right = 450.0 +margin_bottom = 29.0 +size_flags_horizontal = 10 +min_value = 8.0 +max_value = 64.0 +value = 8.0 + +[node name="FontBlending" type="CheckButton" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] +margin_top = 366.0 +margin_right = 450.0 +margin_bottom = 395.0 +text = "Font blending" + +[node name="BtnSaveFontOptions" type="Button" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] +margin_left = 198.0 +margin_top = 399.0 +margin_right = 251.0 +margin_bottom = 428.0 +size_flags_horizontal = 4 +text = "Save" + +[node name="HSeparator" type="HSeparator" parent="Main/Tabs/Fonts"] +margin_top = 434.0 +margin_right = 769.0 +margin_bottom = 434.0 +custom_constants/separation = 0 + +[node name="FontConfigInfo" type="RichTextLabel" parent="Main/Tabs/Fonts"] +margin_top = 440.0 +margin_right = 769.0 +margin_bottom = 528.0 +custom_fonts/bold_italics_font = ExtResource( 24 ) +custom_fonts/italics_font = ExtResource( 23 ) +custom_fonts/bold_font = ExtResource( 22 ) +custom_fonts/normal_font = ExtResource( 7 ) +bbcode_enabled = true +bbcode_text = "Existing font configuration will be shown here. +... +... +..." +text = "Existing font configuration will be shown here. +... +... +..." +fit_content_height = true + [node name="Settings" type="VBoxContainer" parent="Main/Tabs"] visible = false anchor_right = 1.0 @@ -913,10 +1150,14 @@ __meta__ = { "_editor_description_": "Stores Tips of the Day and picks one at random." } +[node name="Fonts" type="Node" parent="."] +script = ExtResource( 28 ) + [connection signal="meta_clicked" from="Main/GameInfo/Description" to="." method="_on_Description_meta_clicked"] [connection signal="tab_changed" from="Main/Tabs" to="." method="_on_Tabs_tab_changed"] -[connection signal="tab_changed" from="Main/Tabs" to="Main/Tabs/Mods" method="_on_Tabs_tab_changed"] [connection signal="tab_changed" from="Main/Tabs" to="Main/Tabs/Soundpacks" method="_on_Tabs_tab_changed"] +[connection signal="tab_changed" from="Main/Tabs" to="Main/Tabs/Fonts" method="_on_Tabs_tab_changed"] +[connection signal="tab_changed" from="Main/Tabs" to="Main/Tabs/Mods" method="_on_Tabs_tab_changed"] [connection signal="item_selected" from="Main/Tabs/Game/Builds/BuildsList" to="." method="_on_BuildsList_item_selected"] [connection signal="pressed" from="Main/Tabs/Game/Builds/BtnRefresh" to="." method="_on_BtnRefresh_pressed"] [connection signal="pressed" from="Main/Tabs/Game/BtnInstall" to="." method="_on_BtnInstall_pressed"] @@ -944,6 +1185,15 @@ __meta__ = { [connection signal="confirmed" from="Main/Tabs/Soundpacks/ConfirmDelete" to="Main/Tabs/Soundpacks" method="_on_ConfirmDelete_confirmed"] [connection signal="confirmed" from="Main/Tabs/Soundpacks/ConfirmManualDownload" to="Main/Tabs/Soundpacks" method="_on_ConfirmManualDownload_confirmed"] [connection signal="file_selected" from="Main/Tabs/Soundpacks/InstallFromFileDialog" to="Main/Tabs/Soundpacks" method="_on_InstallFromFileDialog_file_selected"] +[connection signal="status_message" from="Main/Tabs/Fonts" to="." method="_on_status_message"] +[connection signal="item_selected" from="Main/Tabs/Fonts/FontSelection/RightPane/FontsList" to="Main/Tabs/Fonts" method="_on_FontsList_item_selected"] +[connection signal="pressed" from="Main/Tabs/Fonts/FontSelection/RightPane/Buttons/Grid/BtnSetFontUI" to="Main/Tabs/Fonts" method="_on_BtnSetFontX_pressed" binds= [ true, false, false ]] +[connection signal="pressed" from="Main/Tabs/Fonts/FontSelection/RightPane/Buttons/Grid/BtnSetFontMap" to="Main/Tabs/Fonts" method="_on_BtnSetFontX_pressed" binds= [ false, true, false ]] +[connection signal="pressed" from="Main/Tabs/Fonts/FontSelection/RightPane/Buttons/Grid/BtnSetFontOvermap" to="Main/Tabs/Fonts" method="_on_BtnSetFontX_pressed" binds= [ false, false, true ]] +[connection signal="pressed" from="Main/Tabs/Fonts/FontSelection/RightPane/Buttons/Grid/BtnSetFontAll" to="Main/Tabs/Fonts" method="_on_BtnSetFontX_pressed" binds= [ true, true, true ]] +[connection signal="pressed" from="Main/Tabs/Fonts/FontSelection/RightPane/Buttons/BtnResetFont" to="Main/Tabs/Fonts" method="_on_BtnResetFont_pressed"] +[connection signal="toggled" from="Main/Tabs/Fonts/FontSelection/LeftPane/PreviewCyrillic" to="Main/Tabs/Fonts" method="_on_PreviewCyrillic_toggled"] +[connection signal="pressed" from="Main/Tabs/Fonts/FontSelection/LeftPane/BtnSaveFontOptions" to="Main/Tabs/Fonts" method="_on_BtnSaveFontOptions_pressed"] [connection signal="toggled" from="Main/Tabs/Settings/ShowGameDesc" to="Main/Tabs/Settings" method="_on_ShowGameDesc_toggled"] [connection signal="toggled" from="Main/Tabs/Settings/PrintTips" to="Main/Tabs/Settings" method="_on_PrintTips_toggled"] [connection signal="toggled" from="Main/Tabs/Settings/UpdateToSame" to="Main/Tabs/Settings" method="_on_UpdateToSame_toggled"] @@ -992,3 +1242,4 @@ __meta__ = { [connection signal="soundpack_installation_finished" from="Sound" to="." method="_on_soundpack_operation_finished"] [connection signal="soundpack_installation_started" from="Sound" to="." method="_on_soundpack_operation_started"] [connection signal="status_message" from="Sound" to="." method="_on_status_message"] +[connection signal="status_message" from="Fonts" to="." method="_on_status_message"] diff --git a/scripts/FontManager.gd b/scripts/FontManager.gd new file mode 100644 index 00000000..6acf2568 --- /dev/null +++ b/scripts/FontManager.gd @@ -0,0 +1,260 @@ +extends Node + + +signal status_message + + +const _DEFAULT_FONTS = ["data/font/Terminus.ttf", "data/font/unifont.ttf"] + +onready var _settings = $"/root/SettingsManager" +onready var _workdir := OS.get_executable_path().get_base_dir() + +var _game_options: Array = [] + +var available_fonts: Array = [] setget , _get_available_fonts +var font_config: Dictionary = {} setget , _get_font_config + + +func _get_available_fonts() -> Array: + + return available_fonts + + +func _get_font_config() -> Dictionary: + + return font_config + + +func get_game_option(name: String): + + for item in _game_options: + if item["name"] == name: + return item["value"] + + emit_signal("status_message", "Tried to get game option \"%s\", but it wasn't found." + % name, Enums.MSG_ERROR) + + +func set_game_option(name: String, value: String): + + for item in _game_options: + if item["name"] == name: + item["value"] = value + return + + emit_signal("status_message", "Tried to set game option \"%s\", but it wasn't found." + % name, Enums.MSG_ERROR) + + +func load_available_fonts() -> void: + + var f := File.new() + var error := f.open("res://fonts/ingame/font_info.json", File.READ) + + if error: + emit_signal("status_message", "Failed to open bundled font info.", Enums.MSG_ERROR) + return + + var json_result := JSON.parse(f.get_as_text()) + + if json_result.error: + emit_signal("status_message", "Could not parse bundled font info.", Enums.MSG_ERROR) + emit_signal("status_message", "Error code: %s. Error line: %s. Error message: %s" + % [json_result.error, json_result.error_line, json_result.error_string], Enums.MSG_DEBUG) + return + + available_fonts = json_result.result + + +func load_font_config() -> void: + + var result: Dictionary = {} + var config_file: String = _workdir.plus_file(_settings.read("game")).\ + plus_file("current").plus_file("config").plus_file("fonts.json") + + if Directory.new().file_exists(config_file): + var f := File.new() + var err = f.open(config_file, File.READ) + if err == 0: + var parse_result := JSON.parse(f.get_as_text()) + if parse_result.error == 0: + result = parse_result.result + else: + emit_signal("status_message", "Could not parse font config file %s." % config_file, Enums.MSG_ERROR) + emit_signal("status_message", "Error code: %s. Error line: %s. Error message: %s" + % [parse_result.error, parse_result.error_line, parse_result.error_string], Enums.MSG_DEBUG) + else: + emit_signal("status_message", "Could not open font config file %s (error code: %s)." + % [config_file, err], Enums.MSG_ERROR) + else: + emit_signal("status_message", "Font config file %s is not found!", Enums.MSG_ERROR) + + font_config = result + + +func load_game_options() -> void: + + var options_file: String = _workdir.plus_file(_settings.read("game")).\ + plus_file("current").plus_file("config").plus_file("options.json") + + if Directory.new().file_exists(options_file): + var f := File.new() + var err = f.open(options_file, File.READ) + if err == 0: + var parse_result := JSON.parse(f.get_as_text()) + if parse_result.error == 0: + _game_options = parse_result.result + else: + emit_signal("status_message", "Could not parse game options file %s." % options_file, Enums.MSG_ERROR) + emit_signal("status_message", "Error code: %s. Error line: %s. Error message: %s" + % [parse_result.error, parse_result.error_line, parse_result.error_string], Enums.MSG_DEBUG) + else: + emit_signal("status_message", "Could not open game options file %s (error code: %s)." + % [options_file, err], Enums.MSG_ERROR) + else: + emit_signal("status_message", "Game options file %s is not found!", Enums.MSG_ERROR) + + +func _write_font_config() -> void: + + var config_file: String = _workdir.plus_file(_settings.read("game")).\ + plus_file("current").plus_file("config").plus_file("fonts.json") + + var f = File.new() + var err = f.open(config_file, File.WRITE) + if err == 0: + var json = JSON.print(font_config, " ") + f.store_string(json) + f.close() + else: + emit_signal("status_message", "Could not open font config file %s for writing." + % config_file, Enums.MSG_ERROR) + + +func write_game_options() -> void: + + var options_file: String = _workdir.plus_file(_settings.read("game")).\ + plus_file("current").plus_file("config").plus_file("options.json") + + var f = File.new() + var err = f.open(options_file, File.WRITE) + if err == 0: + var json = JSON.print(_game_options, " ") + f.store_string(json) + f.close() + emit_signal("status_message", "Saved game options to [i]options.json[/i].") + else: + emit_signal("status_message", "Could not open game options file %s for writing." + % options_file, Enums.MSG_ERROR) + + +func _install_font(font_index: int) -> bool: + + var d := Directory.new() + var font_file = available_fonts[font_index]["file"] + var source := "res://fonts/ingame".plus_file(font_file) + var dest := _workdir.plus_file(_settings.read("game")).plus_file("current")\ + .plus_file("font").plus_file(font_file) + var err = d.copy(source, dest) + + if err: + emit_signal("status_message", "Could not install font file %s (error code: %s)." + % [font_file, err], Enums.MSG_ERROR) + emit_signal("status_message", "Font source: %s. Destination: %s." + % [source, dest], Enums.MSG_DEBUG) + return false + else: + return true + + +func set_font(font_index: int, ui: bool, map: bool, overmap: bool) -> void: + + if (font_index < 0) or (font_index >= len(available_fonts)): + emit_signal("status_message", "set_font was passed invalid font index %s." + % font_index, Enums.MSG_ERROR) + return + + if not _install_font(font_index): + return + + var fields = [] + if ui: + fields.append("typeface") + if map: + fields.append("map_typeface") + if overmap: + fields.append("overmap_typeface") + + for field in fields: + if field in font_config: + if len(font_config[field]) <= 2: + font_config[field].push_front(available_fonts[font_index]["file"]) + else: + font_config[field][0] = available_fonts[font_index]["file"] + else: + emit_signal("status_message", "Font config does not have field \"%s\"." + % field, Enums.MSG_ERROR) + + _write_font_config() + + +func reset_font() -> void: + + for field in ["typeface", "map_typeface", "overmap_typeface"]: + font_config[field] = _DEFAULT_FONTS.duplicate() + + _write_font_config() + + +func _get_current_font_indices() -> Dictionary: + # Finds out which bundled fonts from available_fonts are currently + # set in fonts.json (if any). + + var result := {} + + for field in ["typeface", "map_typeface", "overmap_typeface"]: + var file: String = font_config[field][0] + var index := -1 + for i in len(available_fonts): + if available_fonts[i]["file"] == file: + index = i + break + result[field] = index + + return result + + +func set_font_sizes(ui: int, map: int, overmap: int) -> void: + + var current_indices := _get_current_font_indices() + var height_ratio: float + var width_ratio: float + + var index: int = current_indices["typeface"] + if index >= 0: + height_ratio = available_fonts[index]["height"] + width_ratio = available_fonts[index]["width"] + else: + height_ratio = 1.0 + width_ratio = 0.5 + set_game_option("FONT_SIZE", str(ui)) + set_game_option("FONT_HEIGHT", str(int(ui * height_ratio))) + set_game_option("FONT_WIDTH", str(int(ui * width_ratio))) + + index = current_indices["map_typeface"] + if index >= 0: + height_ratio = available_fonts[index]["height"] + else: + height_ratio = 1.0 + set_game_option("MAP_FONT_SIZE", str(map)) + set_game_option("MAP_FONT_HEIGHT", str(int(map * height_ratio))) + set_game_option("MAP_FONT_WIDTH", str(int(map * height_ratio))) + + index = current_indices["overmap_typeface"] + if index >= 0: + height_ratio = available_fonts[index]["height"] + else: + height_ratio = 1.0 + set_game_option("OVERMAP_FONT_SIZE", str(overmap)) + set_game_option("OVERMAP_FONT_HEIGHT", str(int(overmap * height_ratio))) + set_game_option("OVERMAP_FONT_WIDTH", str(int(overmap * height_ratio))) diff --git a/scripts/FontsUI.gd b/scripts/FontsUI.gd new file mode 100644 index 00000000..df205500 --- /dev/null +++ b/scripts/FontsUI.gd @@ -0,0 +1,202 @@ +extends VBoxContainer + + +signal status_message + + +const _PREVIEW_TEXT_EN := [ + "A quick brown fox jumps over the lazy dog.", + "A quart jar of oil mixed with zinc oxide makes a very bright paint.", + "A quick movement of the enemy will jeopardize six gunboats.", + "A wizard’s job is to vex chumps quickly in fog.", + "Amazingly few discotheques provide jukeboxes.", + "Few black taxis drive up major roads on quiet hazy nights.", + "Jack quietly moved up front and seized the big ball of wax.", + "Just keep examining every low bid quoted for zinc etchings.", + "Just work for improved basic techniques to maximize your typing skill.", + "My faxed joke won a pager in the cable TV quiz show.", + "My girl wove six dozen plaid jackets before she quit.", + "Pack my box with five dozen liquor jugs.", + "Six big devils from Japan quickly forgot how to waltz.", + "Six boys guzzled cheap raw plum vodka quite joyfully.", + "Sixty zippers were quickly picked from the woven jute bag.", + "The five boxing wizards jump quickly.", + "The lazy major was fixing Cupid’s broken quiver.", + "The public was amazed to view the quickness and dexterity of the juggler.", + "We promptly judged antique ivory buckles for the next prize.", + "Whenever the black fox jumped the squirrel gazed suspiciously.", +] + +const _PREVIEW_TEXT_RU := [ + "Аэрофотосъёмка ландшафта уже выявила земли богачей и процветающих крестьян.", + "Блеф разъедает ум, чаще цыгана живёшь беспокойно, юля — грех это!", + "В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!", + "Вопрос футбольных энциклопедий замещая чушью: эй, где съеден ёж?", + "Лингвисты в ужасе: фиг выговоришь этюд: «подъём челябинский, запах щец».", + "Обдав его удушающей пылью, множество ярких фаэтонов исчезло из цирка.", + "Однажды съев фейхоа, я, как зацикленный, ностальгирую всё чаще и больше по этому чуду.", + "Пиши: зять съел яйцо, ещё чан брюквы… эх! Ждём фигу!", + "Подъехал шофёр на рефрижераторе грузить яйца для обучающихся элитных медиков.", + "Расчешись! Объявляю: туфли у камина, где этот хищный ёж цаплю задел.", + "Съел бы ёж лимонный пьезокварц, где электрическая юла яшму с туфом похищает.", + "Съешь ещё этих мягких французских булок, да выпей же чаю.", + "Флегматичная эта верблюдица жуёт у подъезда засыхающий горький шиповник.", + "Художник-эксперт с компьютером всего лишь яйца в объёмный низкий ящик чохом фасовал.", + "Шалящий фавн прикинул объём горячих звезд этих вьюжных царств.", + "Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства.", + "Шифровальщица попросту забыла ряд ключевых множителей и тэгов.", + "Эй, жлоб! Где туз? Прячь юных съёмщиц в шкаф.", + "Эй, цирюльникъ, ёжик выстриги, да щетину ряхи сбрей, феном вошь за печь гони!", + "Эти ящерицы чешут вперёд за ключом, но багаж в сейфах, поди подъедь…", + "Южно-эфиопский грач увёл мышь за хобот на съезд ящериц.", +] + +const _PREVIEW_TEXT_NUM := "1234567890 !@#$ %^&* ()[]{}" + +onready var _rng := RandomNumberGenerator.new() +onready var _geom := $"/root/WindowGeometry" +onready var _settings := $"/root/SettingsManager" +onready var _fonts := $"/root/Catapult/Fonts" +onready var _list := $FontSelection/RightPane/FontsList +onready var _btn_set_ui := $FontSelection/RightPane/Buttons/Grid/BtnSetFontUI +onready var _btn_set_map := $FontSelection/RightPane/Buttons/Grid/BtnSetFontMap +onready var _btn_set_om := $FontSelection/RightPane/Buttons/Grid/BtnSetFontOvermap +onready var _btn_set_all := $FontSelection/RightPane/Buttons/Grid/BtnSetFontAll +onready var _preview := $FontSelection/LeftPane/Preview +onready var _cbox_cyrillic = $FontSelection/LeftPane/PreviewCyrillic +onready var _info := $FontConfigInfo +onready var _sb_font_ui := $FontSelection/LeftPane/FontSizeUI/sbFontSizeUI +onready var _sb_font_map := $FontSelection/LeftPane/FontSizeMap/sbFontSizeMap +onready var _sb_font_om := $FontSelection/LeftPane/FontSizeOvermap/sbFontSizeOM +onready var _cbtn_blending := $FontSelection/LeftPane/FontBlending + + +func _make_preview_string(cyrillic: bool = false) -> String: + + var index = _rng.randi_range(0, len(_PREVIEW_TEXT_NUM) - 1) + var result = _PREVIEW_TEXT_NUM + + index = _rng.randi_range(0, len(_PREVIEW_TEXT_EN) - 1) + result += "\n\n" + _PREVIEW_TEXT_EN[index] + + if _settings.read("font_preview_cyrillic"): + index = _rng.randi_range(0, len(_PREVIEW_TEXT_RU) - 1) + result += "\n\n" + _PREVIEW_TEXT_RU[index] + else: + index = _rng.randi_range(0, len(_PREVIEW_TEXT_EN) - 1) + result += "\n\n" + _PREVIEW_TEXT_EN[index] + + return result + + +func _show_current_config_info() -> void: + + var config: Dictionary = _fonts.font_config + var fields := {"typeface": "UI", "map_typeface": "Map", "overmap_typeface": "Overmap"} + var text := "[u]Current fonts + fallbacks:[/u]\n[table=2]" + + for field in fields: + var list: Array = config[field] + var row: String = "\n[cell]%s: [/cell]" % fields[field] + var fonts := "" + for i in len(list): + if i > 0: + fonts += " =>" + fonts += " [i]%s[/i]" % list[i].get_file().get_basename() + row += "[cell]%s[/cell]" % fonts + text += row + + text += "\n[/table]" + + _info.bbcode_text = text + + +func _load_font_options() -> void: + + _fonts.load_game_options() + + _sb_font_ui.value = _fonts.get_game_option("FONT_SIZE") as int + _sb_font_map.value = _fonts.get_game_option("MAP_FONT_SIZE") as int + _sb_font_om.value = _fonts.get_game_option("OVERMAP_FONT_SIZE") as int + _cbtn_blending.pressed = (_fonts.get_game_option("FONT_BLENDING").to_lower() == "true") + + +func _on_Tabs_tab_changed(tab: int) -> void: + + if tab != 3: + return + + _fonts.load_available_fonts() + _fonts.load_font_config() + + for btn in [_btn_set_ui, _btn_set_map, _btn_set_om, _btn_set_all]: + btn.disabled = true + + _list.clear() + for font in _fonts.available_fonts: + _list.add_item(font["name"]) + _list.set_item_tooltip(_list.get_item_count() - 1, font["desc"]) + + _cbox_cyrillic.pressed = _settings.read("font_preview_cyrillic") + _load_font_options() + + _preview.bbcode_text = "" + _show_current_config_info() + + +func _on_FontsList_item_selected(index: int) -> void: + + var font_info = _fonts.available_fonts[index] + var font_path := "res://fonts/ingame".plus_file(font_info["file"]) + var font_res = DynamicFont.new() + + font_res.font_data = load(font_path) + font_res.size = 15.0 * _geom.scale + + _preview.add_font_override("normal_font", font_res) + _preview.bbcode_text = _make_preview_string(_settings.read("font_preview_cyrillic")) + + for btn in [_btn_set_ui, _btn_set_map, _btn_set_om, _btn_set_all]: + btn.disabled = false + + +func _on_BtnSetFontX_pressed(ui: bool, map: bool, overmap: bool) -> void: + + var index = _list.get_selected_items()[0] + var name = _fonts.available_fonts[index]["name"] + + if ui: + emit_signal("status_message", "Setting [i]%s[/i] as game UI font." % name) + if map: + emit_signal("status_message", "Setting [i]%s[/i] as map font." % name) + if overmap: + emit_signal("status_message", "Setting [i]%s[/i] as overmap font." % name) + + _fonts.set_font(index, ui, map, overmap) + _on_BtnSaveFontOptions_pressed() + _show_current_config_info() + + +func _on_BtnResetFont_pressed() -> void: + + _fonts.reset_font() + _on_BtnSaveFontOptions_pressed() + _show_current_config_info() + + +func _on_PreviewCyrillic_toggled(button_pressed: bool) -> void: + + _settings.store("font_preview_cyrillic", button_pressed) + _preview.bbcode_text = _make_preview_string(_settings.read("font_preview_cyrillic")) + + +func _on_BtnSaveFontOptions_pressed() -> void: + + var size_ui := int(_sb_font_ui.value) + var size_map := int(_sb_font_map.value) + var size_om := int(_sb_font_om.value) + + _fonts.set_font_sizes(size_ui, size_map, size_om) + + _fonts.set_game_option("FONT_BLENDING", str(_cbtn_blending.pressed)) + _fonts.write_game_options() diff --git a/scripts/settings_manager.gd b/scripts/settings_manager.gd index cd61fd9b..844ec87d 100644 --- a/scripts/settings_manager.gd +++ b/scripts/settings_manager.gd @@ -18,6 +18,7 @@ const _HARDCODED_DEFAULTS = { "show_stock_mods": false, "show_installed_mods_in_available": false, "show_stock_sound": false, + "font_preview_cyrillic": false, "show_game_desc": true, "debug_mode": false, "game_data_to_migrate": [