diff --git a/src/FreetypeRenderer.h b/src/FreetypeRenderer.h index 2a645648..b30aaab3 100644 --- a/src/FreetypeRenderer.h +++ b/src/FreetypeRenderer.h @@ -70,17 +70,16 @@ public: } friend std::ostream & operator << (std::ostream &stream, const FreetypeRenderer::Params ¶ms) { return stream - << "$fn = " << params.fn - << ", text = '" << params.text - << "', size = " << params.size + << "text = \"" << params.text + << "\", size = " << params.size << ", spacing = " << params.spacing - << ", font = '" << params.font - << "', direction = '" << params.direction - << "', language = '" << params.language - << "', script = '" << params.script - << "', halign = '" << params.halign - << "', valign = '" << params.valign - << "'"; + << ", font = \"" << params.font + << "\", direction = \"" << params.direction + << "\", language = \"" << params.language + << "\", script = \"" << params.script + << "\", halign = \"" << params.halign + << "\", valign = \"" << params.valign + << "\", $fn = " << params.fn; } private: double size, spacing, fn; diff --git a/src/text.cc b/src/text.cc index 7f225600..f63fe055 100644 --- a/src/text.cc +++ b/src/text.cc @@ -49,7 +49,7 @@ AbstractNode *TextModule::instantiate(const Context *ctx, const ModuleInstantiat TextNode *node = new TextNode(inst); AssignmentList args; - args += Assignment("t"), Assignment("size"), Assignment("font"); + args += Assignment("text"), Assignment("size"), Assignment("font"); Context c(ctx); c.setVariables(args, evalctx); @@ -67,7 +67,7 @@ AbstractNode *TextModule::instantiate(const Context *ctx, const ModuleInstantiat int text_segments = std::max(((int)floor(segments / 6)) + 2, 2); node->params.set_size(size); node->params.set_fn(text_segments); - node->params.set_text(lookup_string_variable_with_default(c, "t", "")); + node->params.set_text(lookup_string_variable_with_default(c, "text", "")); node->params.set_spacing(lookup_double_variable_with_default(c, "spacing", 1.0)); node->params.set_font(lookup_string_variable_with_default(c, "font", "")); node->params.set_direction(lookup_string_variable_with_default(c, "direction", "ltr")); @@ -93,7 +93,7 @@ FreetypeRenderer::Params TextNode::get_params() const std::string TextNode::toString() const { std::stringstream stream; - stream << "(" << this->params << ")"; + stream << name() << "(" << this->params << ")"; return stream.str(); } diff --git a/testdata/scad/experimental/text-font-alignment-tests.scad b/testdata/scad/experimental/text-font-alignment-tests.scad index add38035..a3cc8c84 100644 --- a/testdata/scad/experimental/text-font-alignment-tests.scad +++ b/testdata/scad/experimental/text-font-alignment-tests.scad @@ -1,4 +1,4 @@ -use <../../ttf/paratype-serif/PTF55F.ttf> +use <../../ttf/liberation-2.00.1/LiberationSans-Regular.ttf> t = "OpenSCAD"; valign = [ @@ -18,7 +18,7 @@ for (a = valign) { translate([10, a[0], 0]) { color("red") square([135, 0.5]); color("blue") square([0.5, 20]); - text(t = t, font = "PT Serif:style=Regular", size = 20, valign = a[1]); + text(text = t, font = "Liberation Sans:style=Regular", size = 20, valign = a[1]); } } @@ -26,7 +26,7 @@ for (a = halign) { translate([160 + 2.23 * a[0], a[0], 0]) { color("red") square([135, 0.5]); color("blue") square([0.5, 20]); - text(t = t, font = "PT Serif:style=Regular", size = 20, halign = a[1]); + text(text = t, font = "Liberation Sans:style=Regular", size = 20, halign = a[1]); } } diff --git a/testdata/scad/experimental/text-font-composition.scad b/testdata/scad/experimental/text-font-composition.scad index aca6b026..a136997e 100644 --- a/testdata/scad/experimental/text-font-composition.scad +++ b/testdata/scad/experimental/text-font-composition.scad @@ -4,4 +4,4 @@ use <../../ttf/liberation-2.00.1/LiberationSans-Regular.ttf> // The U+030A (COMBINING RING ABOVE) should be unioned to the // letter and not generate a hole where the A and the ring // overlap. -text(t = "A\u030a", font = "Liberation Sans", size = 40); +text(text = "A\u030a", font = "Liberation Sans", size = 40); diff --git a/testdata/scad/experimental/text-font-direction-tests.scad b/testdata/scad/experimental/text-font-direction-tests.scad index d500203b..1c704b3c 100644 --- a/testdata/scad/experimental/text-font-direction-tests.scad +++ b/testdata/scad/experimental/text-font-direction-tests.scad @@ -1,4 +1,4 @@ -use <../../ttf/paratype-serif/PTF55F.ttf> +use <../../ttf/liberation-2.00.1/LiberationSans-Regular.ttf> t = "OpenSCAD"; dir = [ @@ -12,6 +12,6 @@ for (a = dir) { translate([a[0], a[1], 0]) { color("red") square([135, 0.5]); color("blue") square([0.5, 20]); - text(t = t, font = "PT Serif:style=Regular", size = 20, direction = a[2]); + text(text = t, font = "Liberation Sans:style=Regular", size = 20, direction = a[2]); } } diff --git a/testdata/scad/experimental/text-font-simple-tests.scad b/testdata/scad/experimental/text-font-simple-tests.scad index 7e660902..14923006 100644 --- a/testdata/scad/experimental/text-font-simple-tests.scad +++ b/testdata/scad/experimental/text-font-simple-tests.scad @@ -1,2 +1,2 @@ -use <../../ttf/paratype-serif/PTF55F.ttf> -text(t = "T-X-U", font = "PT Serif:style=Regular", size = 40, $fn = 2); +use <../../ttf/liberation-2.00.1/LiberationSans-Regular.ttf> +text(text = "T-X-U", font = "Liberation Sans:style=Regular", size = 40, $fn = 2); diff --git a/testdata/scad/experimental/text-font-symbol.scad b/testdata/scad/experimental/text-font-symbol.scad index fe021317..eb7d4d48 100644 --- a/testdata/scad/experimental/text-font-symbol.scad +++ b/testdata/scad/experimental/text-font-symbol.scad @@ -8,7 +8,7 @@ use <../../ttf/amiri-0.106/amiri-regular.ttf> o = 180; t = [ "0123", "ABCD", "abcd" ]; -f = [ "MarVoSym", /* "Webdings" */ "Amiri", "Liberation Sans" ]; +f = [ "MarVoSym", /* "Webdings" */ "Amiri", "Liberation Sans:style=Regular" ]; // Validate that windows symbol fonts are handled correctly. // When following the suggested encoding, the charmap is defined diff --git a/testdata/scad/experimental/text-font-tests.scad b/testdata/scad/experimental/text-font-tests.scad index 6c03893d..ae10b0c9 100644 --- a/testdata/scad/experimental/text-font-tests.scad +++ b/testdata/scad/experimental/text-font-tests.scad @@ -1,6 +1,5 @@ use <../../ttf/amiri-0.106/amiri-regular.ttf> -use <../../ttf/amiri-0.106/amiri-bold.ttf> -use <../../ttf/paratype-serif/PTF55F.ttf> +use <../../ttf/liberation-2.00.1/LiberationSans-Regular.ttf> t1="OpenSCAD"; t2="الخط الأميري"; @@ -8,19 +7,19 @@ t3="типографика"; rotate([45, 0, -45]) { translate([0, 80, 0]) - text(t = t1, font = "PT Serif:style=Regular", size = 20); + text(text = t1, font = "Liberation Sans:style=Regular", size = 20); translate([0, 40, 0]) - text(t = t2, font = "Amiri:style=Bold", size = 20, direction = "rtl", language = "ar", script = "arabic"); + text(text = t2, font = "Amiri:style=Regular", size = 20, direction = "rtl", language = "ar", script = "arabic"); - text(t = t2, font = "Amiri:style=Regular", direction = "rtl", size = 20, language = "ar", script = "arabic"); + text(text = t2, font = "Amiri:style=Regular", direction = "rtl", size = 20, language = "ar", script = "arabic"); translate([0, -40, 0]) - text(t = t3, font="PT Serif:style=Regular", size=20, language="ru"); + text(text = t3, font="Liberation Sans:style=Regular", size=20, language="ru"); translate([0, -80, 0]) - text("positional", 30, "PT Serif:style=Regular"); + text("positional", 30, "Liberation Sans:style=Regular"); translate([0, -100, 0]) - text("parameters", 12, "Amiri:style=Bold"); -} \ No newline at end of file + text("parameters", 12, "Amiri:style=Regular"); +} diff --git a/testdata/ttf/amiri-0.106/amiri-bold.ttf b/testdata/ttf/amiri-0.106/amiri-bold.ttf deleted file mode 100644 index aef4d491..00000000 Binary files a/testdata/ttf/amiri-0.106/amiri-bold.ttf and /dev/null differ diff --git a/testdata/ttf/paratype-serif/OT_TT_Install_E.txt b/testdata/ttf/paratype-serif/OT_TT_Install_E.txt deleted file mode 100644 index 102634ba..00000000 --- a/testdata/ttf/paratype-serif/OT_TT_Install_E.txt +++ /dev/null @@ -1,70 +0,0 @@ -OpenType TT Font Installation - -- OpenType TrueType (OT/TT) consists of one file with TTF extension. -- OpenType fonts can be installed and used in any version of Windows and on Mac OS X system. -- You may install OpenType fonts by the means of operating system or with the help of font management utilities. - -Installing OpenType fonts for common operating systems: - -- - - - - - -Windows 95/98/NT/ME - -You may install about 800 fonts maximum in Windows ME, 98, or 95. -You may install OpenType/TT fonts by the means of operating system or with the help of font management utilities. -Installing OpenType/TT fonts on Windows by means of operating system: -Click on Start button and select Settings > Control Panel (or Open My Computer then Control Panel) -Open (Double-click) the Fonts folder. -Select File - Install New Font. -Use the Folders and Drives windows to move to the folder on your hard drive, a floppy disk, or CD where -your new fonts are located. (Make sure you have unzipped the files). -If you are installing fonts from a floppy or CD be sure the 'Copy fonts to folder' box is checked; otherwise, -fonts may not be available to use if the floppy or CD is not in the drive at all times. -Highlight the font to install from the List of fonts window. To select more than one font, hold down the -CTRL key and click each font. Click OK. -After installation, you may need to restart an application or reselect a printer in your application to make -the new fonts appear in the font list. - -- - - - - - - -Windows 2000/XP/Vista/Windows 7 - -These Windows versions have built-in support for OpenType fonts. Installation procedure is identical for -all formats. -Open Control Panel. -In Windows 2000 double-click on My Computer. Then double-click on the Control Panel icon. -In Windows XP and later click on Start button and then on Control Panel. -Double-click on the Fonts icon in Control Panel window. -In the Fonts window, select the File menu, and choose Install New Font. -Navigate to the folder that contains fonts you want to install. -Select fonts you want to install. You can click to select one font, Control-click to select several fonts, or Shift-click -to select a contiguous group of fonts. -Press the "OK" button to install the fonts. -Close the Fonts control panel. -After installation, you may need to restart an application or reselect a printer in your application to make the new fonts -appear in the font list. - -- - - - - - -Mac OS 7.x-9.x - -DOES NOT SUPPORT OT/TT. - -- - - - - - -Mac OS X - -An OpenType font consists of one Suitcase file. -You may install fonts by means of operating system or with the help of font management utilities. To install with a font -management applications like Adobe Type Manager, Suitcase or Font Reserve, please consult the product manual. -Font installation on Mac is a simple drag and drop operation. -Close any open applications before installing fonts. New fonts do not appear in the font menu in some applications, -if you install them while an application is open. -Open the folder with fonts to install. -Make sure you are selecting fonts themselves, not a folder containing fonts. -Drag the selection to the Fonts folder inside the Library folder (see details below) on Mac OS X disk. -If you want fonts to be available to applications running in Classic mode, you must also install the fonts into the -Fonts folder inside the Classic System Folder. - -- - - - - - -Read more about OpenType fonts installation on our website: -http://www.paratype.com/help/finst/ - -OpenType Overview -http://www.paratype.com/help/formats/opentype.asp \ No newline at end of file diff --git a/testdata/ttf/paratype-serif/OT_TT_Install_R.txt b/testdata/ttf/paratype-serif/OT_TT_Install_R.txt deleted file mode 100644 index 0a390050..00000000 --- a/testdata/ttf/paratype-serif/OT_TT_Install_R.txt +++ /dev/null @@ -1,55 +0,0 @@ -Óñòàíîâêà øðèôòîâ OpenType TT. - -- Øðèôòû OpenType íà îñíîâå TrueType (OT/TT) ñîñòîÿò èç îäíîãî ôàéëà ñ ðàñøèðåíèåì TTF. -- Øðèôòû OpenType ìîãóò áûòü óñòàíîâëåíû íà ëþáîé âåðñèè Windows, à òàêæå íà Mac OS 10.x. -- Øðèôòû OpenType ìîæíî èíñòàëëèðîâàòü ñðåäñòâàìè îïåðàöèîííîé ñèñòåìû èëè ñ ïîìîùüþ - øðèôòîâîé óòèëèòû Adobe Type Manager. - -Èíñòðóêöèè ïî óñòàíîâêå øðèôòîâ â ðàçëè÷íûõ ñèñòåìàõ: -- - - - - - -Windows 95/98/NT/ME - -Ìàêñèìàëüíîå êîëè÷åñòâî óñòàíîâëåííûõ øðèôòîâ - 800. -Óñòàíîâêà øðèôòîâ ïðîèçâîäèòñÿ ëèáî ñðåäñòâàìè ÎÑ, ëèáî ñ èñïîëüçîâàíèåì ñïåöèàëüíûõ ïðîãðàìì. -Óñòàíîâêà øðèôòîâ OpenType TT â Windows ñðåäñòâàìè ÎÑ: -Îòêðîéòå Ïóñê - Íàñòðîéêà - Ïàíåëü óïðàâëåíèÿ. -Îòêðîéòå ïàïêó Øðèôòû. -Âûáåðèòå Ôàéë - Óñòàíîâèòü íîâûé øðèôò. -Íàéäèòå è îòêðîéòå ïàïêó, â êîòîðîé íàõîäèòñÿ ôàéëû øðèôòîâ. -Ù¸ëêíèòå ìûøüþ ïî ïîÿâèâøèìñÿ èìåíàì øðèôòîâ èç Ñïèñêà øðèôòîâ. ×òîáû âûäåëèòü áîëåå îäíîãî øðèôòà, -óäåðæèâàéòå êëàâèøó CTRL è âûäåëÿéòå ìûøüþ êàæäûé øðèôò. Íàæìèòå ÎÊ. -Ïîñëå èíñòàëëÿöèè íåîáõîäèìî ïåðåçàïóñòèòü ïðèëîæåíèÿ èëè çàíîâî âûáðàòü ïðèíòåð â ïðèëîæåíèè ñ òåì, -÷òîáû íîâûå øðèôòû ïîÿâèëèñü â øðèôòîâîì ìåíþ. -- - - - - - - -Windows 2000/XP/Vista/Windows 7 - -Ýòè âåðñèè Windows èìåþò âñòðîåííóþ ïîääåðæó OpenType øðèôòîâ. -Îòêðîéòå Ïóñê - Íàñòðîéêà - Ïàíåëü óïðàâëåíèÿ. -Îòêðîéòå ïàïêó Øðèôòû â Ïàíåëè óïðàâëåíèÿ. -Âûáåðèòå Ôàéë - Óñòàíîâèòü íîâûé øðèôò. -Íàéäèòå è îòêðîéòå ïàïêó, â êîòîðîé íàõîäèòñÿ ôàéëû øðèôòîâ. -Ù¸ëêíèòå ìûøüþ ïî ïîÿâèâøèìñÿ èìåíàì øðèôòîâ èç Ñïèñêà øðèôòîâ. ×òîáû âûäåëèòü áîëåå îäíîãî øðèôòà, -óäåðæèâàéòå êëàâèøó CTRL è âûäåëÿéòå ìûøüþ êàæäûé øðèôò. Íàæìèòå ÎÊ. -Ïîñëå èíñòàëëÿöèè íåîáõîäèìî ïåðåçàïóñòèòü ïðèëîæåíèÿ èëè çàíîâî âûáðàòü ïðèíòåð â ïðèëîæåíèè ñ òåì, -÷òîáû íîâûå øðèôòû ïîÿâèëèñü â øðèôòîâîì ìåíþ. -- - - - - - -Mac OS 7.x-9.x - -Íå ïîääåðæèâàåò OT/TT. -- - - - - - -Mac OS X - -OpenType øðèôò ñîñòîèò èç îäíîãî "÷åìîäàíà". -Øðèôòû OpenType ìîæíî èíñòàëëèðîâàòü ñðåäñòâàìè îïåðàöèîííîé ñèñòåìû èëè ñ ïîìîùüþ øðèôòîâîé óòèëèòû -Adobe Type Manager. Óñòàíîâêà øðèôòîâ â ÎÑ Mac - ïðîñòàÿ îïåðàöèÿ. -Çàêðîéòå âñå ïðèëîæåíèÿ ïåðåä óñòàíîâêîé. Íîâûå øðèôòû íå ïîÿâëÿþòñÿ â íåêîòîðûõ øðèôòîâûõ ìåíþ, åñëè -óñòàíîâêà âûïîëíÿåòñÿ ïðè àêòèâíîì ïðèëîæåíèè. Îòêðîéòå ïàïêó ñî øðèôòàìè. -Óáåäèòåñü, ÷òî âû âûäåëÿåòå øðèôòû, à íå ïàïêó ñî øðèôòàìè. -Ïåðåòàùèòå âûäåëåííûå øðèôòû â ïàïêó Library, íàõîäÿùóþñÿ íà äèñêå Mac OS X. -- - - - - - - -Ïîäðîáíåå îá óñòàíîâêå OpenType øðèôòîâ âû ìîæåòå ïðî÷èòàòü íà ñàéòå êîìïàíèè ÏàðàÒàéï: -http://www.paratype.com/help/finst/ - -Îáçîð øðèôòîâ OpenType: -http://www.paratype.com/help/formats/opentype.asp \ No newline at end of file diff --git a/testdata/ttf/paratype-serif/PT Free Font License_eng_1.2.txt b/testdata/ttf/paratype-serif/PT Free Font License_eng_1.2.txt deleted file mode 100644 index b5023afb..00000000 --- a/testdata/ttf/paratype-serif/PT Free Font License_eng_1.2.txt +++ /dev/null @@ -1,44 +0,0 @@ -Copyright (c) 2009, ParaType Ltd. All Rights Reserved. - -LICENSING AGREEMENT -for the fonts with Original Name: PT Sans, PT Serif -Version 1.2 - December 23, 2010 - -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/testdata/ttf/paratype-serif/PT Free Font License_rus_1.2.txt b/testdata/ttf/paratype-serif/PT Free Font License_rus_1.2.txt deleted file mode 100644 index fc7b8d38..00000000 Binary files a/testdata/ttf/paratype-serif/PT Free Font License_rus_1.2.txt and /dev/null differ diff --git a/testdata/ttf/paratype-serif/PTF55F.ttf b/testdata/ttf/paratype-serif/PTF55F.ttf deleted file mode 100644 index ed3e1b19..00000000 Binary files a/testdata/ttf/paratype-serif/PTF55F.ttf and /dev/null differ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0635e31f..df19d993 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1135,8 +1135,10 @@ list(APPEND EXPERIMENTAL_TEXT_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/experimental/text-font-symbol.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/experimental/text-search-test.scad) +add_cmdline_test(dumptest EXE ${OPENSCAD_BINPATH} ARGS --enable=text -o SUFFIX csg FILES ${EXPERIMENTAL_TEXT_FILES}) add_cmdline_test(cgalpngtest EXE ${OPENSCAD_BINPATH} ARGS --render --enable=text -o SUFFIX png FILES ${EXPERIMENTAL_TEXT_FILES}) add_cmdline_test(opencsgtest EXE ${OPENSCAD_BINPATH} ARGS --enable=text -o SUFFIX png FILES ${EXPERIMENTAL_TEXT_FILES}) +add_cmdline_test(csgpngtest EXE ${PYTHON_EXECUTABLE} SCRIPT ${CMAKE_SOURCE_DIR}/export_import_pngtest.py ARGS --openscad=${OPENSCAD_BINPATH} --format=csg EXPECTEDDIR cgalpngtest SUFFIX png FILES ${EXPERIMENTAL_TEXT_FILES}) add_cmdline_test(throwntogethertest EXE ${OPENSCAD_BINPATH} ARGS --preview=throwntogether --enable=text -o SUFFIX png FILES ${EXPERIMENTAL_TEXT_FILES}) # Tests using the actual OpenSCAD binary diff --git a/tests/export_import_pngtest.py b/tests/export_import_pngtest.py index 68cf2d7a..5eec8907 100644 --- a/tests/export_import_pngtest.py +++ b/tests/export_import_pngtest.py @@ -77,7 +77,7 @@ if inputsuffix != '.scad' and inputsuffix != '.csg': # # First run: Just export the given filetype # -export_cmd = [args.openscad, inputfile, '-o', exportfile] + remaining_args +export_cmd = [args.openscad, inputfile, '--enable=text', '-o', exportfile] + remaining_args print('Running OpenSCAD #1:') print(' '.join(export_cmd)) result = subprocess.call(export_cmd) @@ -94,7 +94,7 @@ if args.format != 'csg': newscadfile += '.scad' createImport(exportfile, newscadfile) -create_png_cmd = [args.openscad, newscadfile, '--render', '-o', pngfile] + remaining_args +create_png_cmd = [args.openscad, newscadfile, '--enable=text', '--render', '-o', pngfile] + remaining_args print('Running OpenSCAD #2:') print(' '.join(create_png_cmd)) result = subprocess.call(create_png_cmd) diff --git a/tests/regression/cgalpngtest/text-font-alignment-tests-expected.png b/tests/regression/cgalpngtest/text-font-alignment-tests-expected.png index 4f5a5649..d3a149d3 100644 Binary files a/tests/regression/cgalpngtest/text-font-alignment-tests-expected.png and b/tests/regression/cgalpngtest/text-font-alignment-tests-expected.png differ diff --git a/tests/regression/cgalpngtest/text-font-composition-expected.png b/tests/regression/cgalpngtest/text-font-composition-expected.png index 8fb72623..c8a0c54a 100644 Binary files a/tests/regression/cgalpngtest/text-font-composition-expected.png and b/tests/regression/cgalpngtest/text-font-composition-expected.png differ diff --git a/tests/regression/cgalpngtest/text-font-direction-tests-expected.png b/tests/regression/cgalpngtest/text-font-direction-tests-expected.png index 3319b0a8..f2e78c4c 100644 Binary files a/tests/regression/cgalpngtest/text-font-direction-tests-expected.png and b/tests/regression/cgalpngtest/text-font-direction-tests-expected.png differ diff --git a/tests/regression/cgalpngtest/text-font-simple-tests-expected.png b/tests/regression/cgalpngtest/text-font-simple-tests-expected.png index 147cdaf5..6b1e8f77 100644 Binary files a/tests/regression/cgalpngtest/text-font-simple-tests-expected.png and b/tests/regression/cgalpngtest/text-font-simple-tests-expected.png differ diff --git a/tests/regression/cgalpngtest/text-font-tests-expected.png b/tests/regression/cgalpngtest/text-font-tests-expected.png index 8df89d7e..bb00dba2 100644 Binary files a/tests/regression/cgalpngtest/text-font-tests-expected.png and b/tests/regression/cgalpngtest/text-font-tests-expected.png differ diff --git a/tests/regression/dumptest/text-font-alignment-tests-expected.csg b/tests/regression/dumptest/text-font-alignment-tests-expected.csg index 3402a68e..9aa8f915 100644 --- a/tests/regression/dumptest/text-font-alignment-tests-expected.csg +++ b/tests/regression/dumptest/text-font-alignment-tests-expected.csg @@ -7,7 +7,7 @@ group() { color([0, 0, 1, 1]) { square(size = [0.5, 20], center = false); } - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ltr', language = 'en', script = 'latin', halign = 'left', valign = 'top'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "left", valign = "top", $fn = 7); } multmatrix([[1, 0, 0, 10], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { color([1, 0, 0, 1]) { @@ -16,7 +16,7 @@ group() { color([0, 0, 1, 1]) { square(size = [0.5, 20], center = false); } - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ltr', language = 'en', script = 'latin', halign = 'left', valign = 'center'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "left", valign = "center", $fn = 7); } multmatrix([[1, 0, 0, 10], [0, 1, 0, 70], [0, 0, 1, 0], [0, 0, 0, 1]]) { color([1, 0, 0, 1]) { @@ -25,7 +25,7 @@ group() { color([0, 0, 1, 1]) { square(size = [0.5, 20], center = false); } - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ltr', language = 'en', script = 'latin', halign = 'left', valign = 'baseline'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "left", valign = "baseline", $fn = 7); } multmatrix([[1, 0, 0, 10], [0, 1, 0, 100], [0, 0, 1, 0], [0, 0, 0, 1]]) { color([1, 0, 0, 1]) { @@ -34,7 +34,7 @@ group() { color([0, 0, 1, 1]) { square(size = [0.5, 20], center = false); } - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ltr', language = 'en', script = 'latin', halign = 'left', valign = 'bottom'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "left", valign = "bottom", $fn = 7); } } group() { @@ -45,7 +45,7 @@ group() { color([0, 0, 1, 1]) { square(size = [0.5, 20], center = false); } - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ltr', language = 'en', script = 'latin', halign = 'left', valign = 'baseline'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "left", valign = "baseline", $fn = 7); } multmatrix([[1, 0, 0, 249.2], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { color([1, 0, 0, 1]) { @@ -54,7 +54,7 @@ group() { color([0, 0, 1, 1]) { square(size = [0.5, 20], center = false); } - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ltr', language = 'en', script = 'latin', halign = 'center', valign = 'baseline'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "center", valign = "baseline", $fn = 7); } multmatrix([[1, 0, 0, 316.1], [0, 1, 0, 70], [0, 0, 1, 0], [0, 0, 0, 1]]) { color([1, 0, 0, 1]) { @@ -63,7 +63,7 @@ group() { color([0, 0, 1, 1]) { square(size = [0.5, 20], center = false); } - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ltr', language = 'en', script = 'latin', halign = 'right', valign = 'baseline'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "right", valign = "baseline", $fn = 7); } } } diff --git a/tests/regression/dumptest/text-font-composition-expected.csg b/tests/regression/dumptest/text-font-composition-expected.csg new file mode 100644 index 00000000..9671302b --- /dev/null +++ b/tests/regression/dumptest/text-font-composition-expected.csg @@ -0,0 +1,3 @@ +group() { + text(text = "AÌŠ", size = 40, spacing = 1, font = "Liberation Sans", direction = "ltr", language = "en", script = "latin", halign = "left", valign = "baseline", $fn = 7); +} diff --git a/tests/regression/dumptest/text-font-direction-tests-expected.csg b/tests/regression/dumptest/text-font-direction-tests-expected.csg index 4aa70b00..35c454c4 100644 --- a/tests/regression/dumptest/text-font-direction-tests-expected.csg +++ b/tests/regression/dumptest/text-font-direction-tests-expected.csg @@ -7,7 +7,7 @@ group() { color([0, 0, 1, 1]) { square(size = [0.5, 20], center = false); } - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ltl', language = 'en', script = 'latin', halign = 'left', valign = 'baseline'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltl", language = "en", script = "latin", halign = "left", valign = "baseline", $fn = 7); } multmatrix([[1, 0, 0, 90], [0, 1, 0, 60], [0, 0, 1, 0], [0, 0, 0, 1]]) { color([1, 0, 0, 1]) { @@ -16,7 +16,7 @@ group() { color([0, 0, 1, 1]) { square(size = [0.5, 20], center = false); } - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'rtl', language = 'en', script = 'latin', halign = 'left', valign = 'baseline'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "rtl", language = "en", script = "latin", halign = "left", valign = "baseline", $fn = 7); } multmatrix([[1, 0, 0, 10], [0, 1, 0, 160], [0, 0, 1, 0], [0, 0, 0, 1]]) { color([1, 0, 0, 1]) { @@ -25,7 +25,7 @@ group() { color([0, 0, 1, 1]) { square(size = [0.5, 20], center = false); } - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ttb', language = 'en', script = 'latin', halign = 'left', valign = 'baseline'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ttb", language = "en", script = "latin", halign = "left", valign = "baseline", $fn = 7); } multmatrix([[1, 0, 0, 60], [0, 1, 0, 140], [0, 0, 1, 0], [0, 0, 0, 1]]) { color([1, 0, 0, 1]) { @@ -34,7 +34,7 @@ group() { color([0, 0, 1, 1]) { square(size = [0.5, 20], center = false); } - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'btt', language = 'en', script = 'latin', halign = 'left', valign = 'baseline'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "btt", language = "en", script = "latin", halign = "left", valign = "baseline", $fn = 7); } } } diff --git a/tests/regression/dumptest/text-font-simple-tests-expected.csg b/tests/regression/dumptest/text-font-simple-tests-expected.csg index 89e915d3..db086747 100644 --- a/tests/regression/dumptest/text-font-simple-tests-expected.csg +++ b/tests/regression/dumptest/text-font-simple-tests-expected.csg @@ -1,3 +1,3 @@ group() { - ($fn = 2, text = 'T-X-U', size = 40, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ltr', language = 'en', script = 'latin', halign = 'left', valign = 'baseline'); + text(text = "T-X-U", size = 40, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "left", valign = "baseline", $fn = 2); } diff --git a/tests/regression/dumptest/text-font-symbol-expected.csg b/tests/regression/dumptest/text-font-symbol-expected.csg new file mode 100644 index 00000000..cc22d96c --- /dev/null +++ b/tests/regression/dumptest/text-font-symbol-expected.csg @@ -0,0 +1,37 @@ +group() { + group() { + group() { + multmatrix([[1, 0, 0, -180], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + text(text = "0123", size = 40, spacing = 1, font = "MarVoSym", direction = "ltr", language = "en", script = "latin", halign = "center", valign = "baseline", $fn = 7); + } + multmatrix([[1, 0, 0, -180], [0, 1, 0, 70], [0, 0, 1, 0], [0, 0, 0, 1]]) { + text(text = "ABCD", size = 40, spacing = 1, font = "MarVoSym", direction = "ltr", language = "en", script = "latin", halign = "center", valign = "baseline", $fn = 7); + } + multmatrix([[1, 0, 0, -180], [0, 1, 0, 130], [0, 0, 1, 0], [0, 0, 0, 1]]) { + text(text = "abcd", size = 40, spacing = 1, font = "MarVoSym", direction = "ltr", language = "en", script = "latin", halign = "center", valign = "baseline", $fn = 7); + } + } + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + text(text = "0123", size = 40, spacing = 1, font = "Amiri", direction = "ltr", language = "en", script = "latin", halign = "center", valign = "baseline", $fn = 7); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 70], [0, 0, 1, 0], [0, 0, 0, 1]]) { + text(text = "ABCD", size = 40, spacing = 1, font = "Amiri", direction = "ltr", language = "en", script = "latin", halign = "center", valign = "baseline", $fn = 7); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 130], [0, 0, 1, 0], [0, 0, 0, 1]]) { + text(text = "abcd", size = 40, spacing = 1, font = "Amiri", direction = "ltr", language = "en", script = "latin", halign = "center", valign = "baseline", $fn = 7); + } + } + group() { + multmatrix([[1, 0, 0, 180], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + text(text = "0123", size = 40, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "center", valign = "baseline", $fn = 7); + } + multmatrix([[1, 0, 0, 180], [0, 1, 0, 70], [0, 0, 1, 0], [0, 0, 0, 1]]) { + text(text = "ABCD", size = 40, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "center", valign = "baseline", $fn = 7); + } + multmatrix([[1, 0, 0, 180], [0, 1, 0, 130], [0, 0, 1, 0], [0, 0, 0, 1]]) { + text(text = "abcd", size = 40, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "center", valign = "baseline", $fn = 7); + } + } + } +} diff --git a/tests/regression/dumptest/text-font-tests-expected.csg b/tests/regression/dumptest/text-font-tests-expected.csg index b9d6fea6..751ead2f 100644 --- a/tests/regression/dumptest/text-font-tests-expected.csg +++ b/tests/regression/dumptest/text-font-tests-expected.csg @@ -1,14 +1,20 @@ group() { multmatrix([[0.70710678118, 0.5, -0.5, 0], [-0.70710678118, 0.5, -0.5, 0], [0, 0.70710678118, 0.70710678118, 0], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 80], [0, 0, 1, 0], [0, 0, 0, 1]]) { - ($fn = 7, text = 'OpenSCAD', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ltr', language = 'en', script = 'latin', halign = 'left', valign = 'baseline'); + text(text = "OpenSCAD", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "left", valign = "baseline", $fn = 7); } multmatrix([[1, 0, 0, 0], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { - ($fn = 7, text = 'الخط الأميري', size = 20, spacing = 1, font = 'Amiri:style=Bold', direction = 'rtl', language = 'ar', script = 'arabic', halign = 'left', valign = 'baseline'); + text(text = "الخط الأميري", size = 20, spacing = 1, font = "Amiri:style=Regular", direction = "rtl", language = "ar", script = "arabic", halign = "left", valign = "baseline", $fn = 7); } - ($fn = 7, text = 'الخط الأميري', size = 20, spacing = 1, font = 'Amiri:style=Regular', direction = 'rtl', language = 'ar', script = 'arabic', halign = 'left', valign = 'baseline'); + text(text = "الخط الأميري", size = 20, spacing = 1, font = "Amiri:style=Regular", direction = "rtl", language = "ar", script = "arabic", halign = "left", valign = "baseline", $fn = 7); multmatrix([[1, 0, 0, 0], [0, 1, 0, -40], [0, 0, 1, 0], [0, 0, 0, 1]]) { - ($fn = 7, text = 'типографика', size = 20, spacing = 1, font = 'PT Serif:style=Regular', direction = 'ltr', language = 'ru', script = 'latin', halign = 'left', valign = 'baseline'); + text(text = "типографика", size = 20, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "ru", script = "latin", halign = "left", valign = "baseline", $fn = 7); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -80], [0, 0, 1, 0], [0, 0, 0, 1]]) { + text(text = "positional", size = 30, spacing = 1, font = "Liberation Sans:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "left", valign = "baseline", $fn = 7); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -100], [0, 0, 1, 0], [0, 0, 0, 1]]) { + text(text = "parameters", size = 12, spacing = 1, font = "Amiri:style=Regular", direction = "ltr", language = "en", script = "latin", halign = "left", valign = "baseline", $fn = 7); } } } diff --git a/tests/regression/opencsgtest/text-font-simple-tests-expected.png b/tests/regression/opencsgtest/text-font-simple-tests-expected.png index e84dc4d5..44160dab 100644 Binary files a/tests/regression/opencsgtest/text-font-simple-tests-expected.png and b/tests/regression/opencsgtest/text-font-simple-tests-expected.png differ diff --git a/tests/regression/throwntogethertest/text-font-simple-tests-expected.png b/tests/regression/throwntogethertest/text-font-simple-tests-expected.png index e84dc4d5..44160dab 100644 Binary files a/tests/regression/throwntogethertest/text-font-simple-tests-expected.png and b/tests/regression/throwntogethertest/text-font-simple-tests-expected.png differ