diff --git a/data/cage-tests/gui/gui.assets b/data/cage-tests/gui/gui.assets index 7f3d636..7d7c9a6 100644 --- a/data/cage-tests/gui/gui.assets +++ b/data/cage-tests/gui/gui.assets @@ -5,9 +5,13 @@ gui.pack [] scheme = font immortal.ttf +immortal.ttf?0 DroidSansMono.ttf +DroidSansMono.ttf?0 asimov.otf +asimov.otf?0 roboto.ttf +roboto.ttf?0 [] scheme = texture diff --git a/data/cage-tests/gui/gui.pack b/data/cage-tests/gui/gui.pack index f028da5..beecb23 100644 --- a/data/cage-tests/gui/gui.pack +++ b/data/cage-tests/gui/gui.pack @@ -11,3 +11,4 @@ texts.po /cage/font/ubuntu/bold.ttf /cage/font/ubuntu/italic.ttf /cage/font/ubuntu/monospace.ttf +noto/universal.ttf diff --git a/data/cage-tests/gui/noto/LICENSE.txt b/data/cage-tests/gui/noto/LICENSE.txt new file mode 100644 index 0000000..f531c7e --- /dev/null +++ b/data/cage-tests/gui/noto/LICENSE.txt @@ -0,0 +1,143 @@ +In the spirit of _loka-saṃgraha_, the scripts distributed in this git +repository (the "Software") are dedicated to the public domain as per +"The Unlicense" (see below). + +However, the fonts generated by using the the Software are licensed +under the SIL Open Font License, Version 1.1, as required by the +upstream Noto Project. + + +=========================== THE UNLICENSE ============================ + +This is free and unencumbered software released into the public +domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +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 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. + +For more information, please refer to + +====================================================================== + + +The upstream Noto Fonts project is distributed under the OFL v1.1: + + +====================================================================== + +Copyright 2018 The Noto Project Authors + +https://github.com/googlefonts/noto-fonts + +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/data/cage-tests/gui/noto/modifications.txt b/data/cage-tests/gui/noto/modifications.txt new file mode 100644 index 0000000..6fc9674 --- /dev/null +++ b/data/cage-tests/gui/noto/modifications.txt @@ -0,0 +1,3 @@ +source: https://github.com/satbyy/go-noto-universal/releases +Aug 1, 2023, v7.0 +file: GoNotoKurrent-Regular.ttf diff --git a/data/cage-tests/gui/noto/noto.assets b/data/cage-tests/gui/noto/noto.assets new file mode 100644 index 0000000..36c79a0 --- /dev/null +++ b/data/cage-tests/gui/noto/noto.assets @@ -0,0 +1,27 @@ +[] +scheme = font +universal.ttf +universal.ttf?0 +universal.ttf?1 +universal.ttf?2 +universal.ttf?3 +universal.ttf?4 +universal.ttf?5 +universal.ttf?6 +universal.ttf?7 +universal.ttf?8 +universal.ttf?9 +universal.ttf?10 +universal.ttf?11 +universal.ttf?12 +universal.ttf?13 +universal.ttf?14 +universal.ttf?15 +universal.ttf?16 +universal.ttf?17 +universal.ttf?18 +universal.ttf?19 +universal.ttf?20 +universal.ttf?21 +universal.ttf?22 +universal.ttf?23 diff --git a/data/cage-tests/gui/noto/universal.ttf b/data/cage-tests/gui/noto/universal.ttf new file mode 100644 index 0000000..9e87b64 Binary files /dev/null and b/data/cage-tests/gui/noto/universal.ttf differ diff --git a/data/cage-tests/texts/texts.pot b/data/cage-tests/texts/texts.pot index 0d82a69..dab2dfc 100644 --- a/data/cage-tests/texts/texts.pot +++ b/data/cage-tests/texts/texts.pot @@ -2,10 +2,10 @@ msgid "short" msgstr "hello" msgid "long/a" -msgstr "brown_fox_jumps_over_a_lazy_dog" +msgstr "brown fox jumps over a lazy dog" msgid "long/b" -msgstr "lorem_ipsum" +msgstr "lorem ipsum dolor sit amet" msgid "params" -msgstr "position: xyz" +msgstr "position: x: {0}, y: {1}, z: {2}" diff --git a/externals/cage b/externals/cage index 141c672..931fb70 160000 --- a/externals/cage +++ b/externals/cage @@ -1 +1 @@ -Subproject commit 141c672b8894979787ce169827b98c29f573570d +Subproject commit 931fb70e7b64225294de9bffd8c059437574b462 diff --git a/sources/gui/texts/fontLineSpacing.cpp b/sources/gui/texts/fontLineSpacing.cpp index de43c99..1884e1b 100644 --- a/sources/gui/texts/fontLineSpacing.cpp +++ b/sources/gui/texts/fontLineSpacing.cpp @@ -13,6 +13,7 @@ const char *FontNames[] = { "cage/font/ubuntu/bold.ttf", "cage/font/ubuntu/italic.ttf", "cage/font/ubuntu/monospace.ttf", + "cage-tests/gui/noto/universal.ttf", }; const String LabelTexts[] = { "Droid Sans Mono", @@ -23,6 +24,7 @@ const String LabelTexts[] = { "Ubuntu Bold", "Ubuntu Italic", "Ubuntu Mono", + "Noto Universal", }; const String multilineText = "lorem ipsum dolor sit amet\npříliš žluťoučký kůň úpěl ďábelské ódy\na quick brown fox jumps over a lazy dog\n\nhello world, foo, bar, baz"; diff --git a/sources/gui/texts/fontScaling.cpp b/sources/gui/texts/fontScaling.cpp index 55b1eb7..2747779 100644 --- a/sources/gui/texts/fontScaling.cpp +++ b/sources/gui/texts/fontScaling.cpp @@ -13,6 +13,7 @@ const char *FontNames[] = { "cage/font/ubuntu/bold.ttf", "cage/font/ubuntu/italic.ttf", "cage/font/ubuntu/monospace.ttf", + "cage-tests/gui/noto/universal.ttf", }; const String LabelTexts[] = { "Droid Sans Mono", @@ -23,6 +24,7 @@ const String LabelTexts[] = { "Ubuntu Bold", "Ubuntu Italic", "Ubuntu Mono", + "Noto Universal", }; const uint32 fontsCount = sizeof(FontNames) / sizeof(FontNames[0]); diff --git a/sources/gui/texts/fontSizes.cpp b/sources/gui/texts/fontSizes.cpp index 99e7209..c859269 100644 --- a/sources/gui/texts/fontSizes.cpp +++ b/sources/gui/texts/fontSizes.cpp @@ -11,6 +11,7 @@ constexpr const char *FontNames[] = { "cage/font/ubuntu/bold.ttf", "cage/font/ubuntu/italic.ttf", "cage/font/ubuntu/monospace.ttf", + "cage-tests/gui/noto/universal.ttf", }; constexpr String LabelTexts[] = { "Droid Sans Mono", @@ -21,6 +22,7 @@ constexpr String LabelTexts[] = { "Ubuntu Bold", "Ubuntu Italic", "Ubuntu Mono", + "Noto Universal", }; constexpr String multilineText = "lorem ipsum dolor sit amet\npříliš žluťoučký kůň úpěl ďábelské ódy\na quick brown fox jumps over a lazy dog\nhello world, foo, bar, baz\n\n"; diff --git a/sources/gui/texts/fontTypography.cpp b/sources/gui/texts/fontTypography.cpp index 3abe801..9bf5bbf 100644 --- a/sources/gui/texts/fontTypography.cpp +++ b/sources/gui/texts/fontTypography.cpp @@ -11,6 +11,7 @@ const char *FontNames[] = { "cage/font/ubuntu/bold.ttf", "cage/font/ubuntu/italic.ttf", "cage/font/ubuntu/monospace.ttf", + "cage-tests/gui/noto/universal.ttf", }; const String LabelTexts[] = { "Droid Sans Mono", @@ -21,6 +22,7 @@ const String LabelTexts[] = { "Ubuntu Bold", "Ubuntu Italic", "Ubuntu Mono", + "Noto Universal", }; const String multilineText = "lorem ipsum dolor sit amet\npříliš žluťoučký kůň úpěl ďábelské ódy\na quick brown fox jumps over a lazy dog\n\nhello world, foo, bar, baz"; diff --git a/sources/gui/texts/multilingualQuotes.cpp b/sources/gui/texts/multilingualQuotes.cpp index 29a3f04..67f8dc4 100644 --- a/sources/gui/texts/multilingualQuotes.cpp +++ b/sources/gui/texts/multilingualQuotes.cpp @@ -12,6 +12,7 @@ class GuiTestImpl : public GuiTestClass public: void initialize() override { + detail::GuiTextFontDefault = HashString("cage-tests/gui/noto/universal.ttf"); auto g = newGuiBuilder(engineGuiEntities()); auto _1 = g->panel(); auto _2 = g->scrollbars(); diff --git a/sources/simple/music.cpp b/sources/simple/music.cpp index cce7586..e0246f9 100644 --- a/sources/simple/music.cpp +++ b/sources/simple/music.cpp @@ -32,7 +32,7 @@ void init() } { // sun - Entity *e = ents->createAnonymous(); + Entity *e = ents->createUnique(); e->value().orientation = Quat(Degs(-90), {}, {}); e->value().lightType = LightTypeEnum::Directional; ShadowmapComponent &s = e->value(); @@ -115,7 +115,7 @@ void update() { Entity *e = ents->get(numeric_cast(it.index) + 200); TransformComponent &t = e->value(); - t.position = *it + Vec3(0, 0.25, 0); + t.position = *it + Vec3(0, 0.4, 0); if (distance(cameraPos, t.position) > 0.1) t.orientation = Quat(t.position - cameraPos, Vec3(0, 1, 0)); } diff --git a/sources/simple/texts.cpp b/sources/simple/texts.cpp index 36a7601..55bf49c 100644 --- a/sources/simple/texts.cpp +++ b/sources/simple/texts.cpp @@ -71,13 +71,11 @@ void update() int main(int argc, char *args[]) { + //detail::GuiTextFontDefault = HashString("cage-tests/gui/noto/universal.ttf"); + try { - // log to console - Holder log1 = newLogger(); - log1->format.bind(); - log1->output.bind(); - + initializeConsoleLogger(); engineInitialize(EngineCreateConfig()); // events @@ -131,19 +129,26 @@ int main(int argc, char *args[]) r.textId = HashString("long/a"); r.color = Vec3(1, 0, 0); TransformComponent &t = e->value(); - t.position = Vec3(-10, 0, 0); - t.orientation = Quat(Degs(), Degs(90), Degs()); + t.position = Vec3(0, 0, -20); } { // text lorem ipsum Entity *e = ents->createAnonymous(); TextComponent &r = e->value(); r.value = "Lorem ipsum dolor sit amet,\nconsectetur adipisici elit,\nsed eiusmod tempor incidunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam,\nquis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat."; r.color = Vec3(0, 0, 1); - r.align = TextAlignEnum::Center; TransformComponent &t = e->value(); t.position = Vec3(10, 0, 0); t.orientation = Quat(Degs(), Degs(-90), Degs()); } + { // text long paragprah + Entity *e = ents->createAnonymous(); + TextComponent &r = e->value(); + r.value = "Za devatero horami a devatero řekami, v kouzelném kraji, kde se sny stávají skutečností, žilo bylo...\r\nKdo? Král, obyčejný chalupník, nebo snad kouzelná bytost? Jak má příběh pokračovat?"; + r.color = Vec3(0.6); + TransformComponent &t = e->value(); + t.position = Vec3(-10, 0, 0); + t.orientation = Quat(Degs(), Degs(90), Degs()); + } { // text params Entity *e = ents->create(10); TextComponent &r = e->value();