diff --git a/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp b/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp index 0661a9e6c9..0248083f2a 100644 --- a/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp +++ b/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp @@ -22,7 +22,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +#include #endif #include @@ -82,18 +82,26 @@ void loadTechDrawResource() Q_INIT_RESOURCE(TechDraw); Gui::Translator::instance()->refresh(); - // add osifont + // add fonts std::string fontDir = App::Application::getResourceDir() + "Mod/TechDraw/Resources/fonts/"; - QString fontFile = Base::Tools::fromStdString(fontDir + "osifont-lgpl3fe.ttf"); QFontDatabase fontDB; - int rc = fontDB.addApplicationFont(fontFile); - if (rc) { - Base::Console().Warning("TechDraw failed to load osifont file: %d from: %s\n", rc, qPrintable(fontFile)); + + std::vector fontsAll( + {"osifont-lgpl3fe.ttf", "osifont-italic.ttf", "Y14.5-2018.ttf", "Y14.5-FreeCAD.ttf"}); + + for (auto& font : fontsAll) { + QString fontFile = Base::Tools::fromStdString(fontDir + font); + int rc = fontDB.addApplicationFont(fontFile); + if (rc < 0) { + Base::Console().Warning( + "TechDraw failed to load font file: %d from: %s\n", rc, qPrintable(fontFile)); + } } } -namespace TechDrawGui { - extern PyObject* initModule(); +namespace TechDrawGui +{ +extern PyObject* initModule(); } /* Python entry */ @@ -107,7 +115,7 @@ PyMOD_INIT_FUNC(TechDrawGui) try { Base::Interpreter().loadModule("TechDraw"); } - catch(const Base::Exception& e) { + catch (const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what()); PyMOD_Return(nullptr); } @@ -152,21 +160,21 @@ PyMOD_INIT_FUNC(TechDrawGui) TechDrawGui::ViewProviderTile::init(); TechDrawGui::ViewProviderWeld::init(); - TechDrawGui::ViewProviderPageExtension ::init(); -// TechDrawGui::ViewProviderPageExtensionPython::init(); + TechDrawGui::ViewProviderPageExtension ::init(); + // TechDrawGui::ViewProviderPageExtensionPython::init(); TechDrawGui::ViewProviderDrawingViewExtension::init(); TechDrawGui::ViewProviderTemplateExtension::init(); TechDrawGui::ViewProviderCosmeticExtension::init(); // register preferences pages - new Gui::PrefPageProducer ("TechDraw"); //General - new Gui::PrefPageProducer ("TechDraw"); //Scale - new Gui::PrefPageProducer("TechDraw"); //Dimensions - new Gui::PrefPageProducer ("TechDraw"); //Annotation - new Gui::PrefPageProducer("TechDraw"); //Colors - new Gui::PrefPageProducer ("TechDraw"); //HLR - new Gui::PrefPageProducer ("TechDraw"); //Advanced + new Gui::PrefPageProducer("TechDraw"); //General + new Gui::PrefPageProducer("TechDraw"); //Scale + new Gui::PrefPageProducer("TechDraw");//Dimensions + new Gui::PrefPageProducer("TechDraw");//Annotation + new Gui::PrefPageProducer("TechDraw"); //Colors + new Gui::PrefPageProducer("TechDraw"); //HLR + new Gui::PrefPageProducer("TechDraw"); //Advanced // add resources and reloads the translators loadTechDrawResource(); diff --git a/src/Mod/TechDraw/Gui/CMakeLists.txt b/src/Mod/TechDraw/Gui/CMakeLists.txt index ea8d415d69..271c8d81fa 100644 --- a/src/Mod/TechDraw/Gui/CMakeLists.txt +++ b/src/Mod/TechDraw/Gui/CMakeLists.txt @@ -453,7 +453,11 @@ SET(TechDrawGuiIcon_SVG ##install OSIFONT SET(TechDrawGuiFonts Resources/fonts/osifont-lgpl3fe.ttf + Resources/fonts/osifont-italic.ttf Resources/fonts/osifont.license + Resources/fonts/Y14.5-2018.ttf + Resources/fonts/Y14.5Font.license + Resources/fonts/Y14.5-FreeCAD.ttf ) if(FREECAD_USE_PCH) diff --git a/src/Mod/TechDraw/Gui/Resources/fonts/Y14.5-2018.ttf b/src/Mod/TechDraw/Gui/Resources/fonts/Y14.5-2018.ttf new file mode 100644 index 0000000000..1125be4ed7 Binary files /dev/null and b/src/Mod/TechDraw/Gui/Resources/fonts/Y14.5-2018.ttf differ diff --git a/src/Mod/TechDraw/Gui/Resources/fonts/Y14.5-FreeCAD.ttf b/src/Mod/TechDraw/Gui/Resources/fonts/Y14.5-FreeCAD.ttf new file mode 100644 index 0000000000..73474d96bc Binary files /dev/null and b/src/Mod/TechDraw/Gui/Resources/fonts/Y14.5-FreeCAD.ttf differ diff --git a/src/Mod/TechDraw/Gui/Resources/fonts/Y14.5Font.license b/src/Mod/TechDraw/Gui/Resources/fonts/Y14.5Font.license new file mode 100644 index 0000000000..2428b7c572 --- /dev/null +++ b/src/Mod/TechDraw/Gui/Resources/fonts/Y14.5Font.license @@ -0,0 +1,8 @@ +ASME Y14.5 Font License + +Original Y14.5-2018.ttf courtesy of Peter Kanold (https://peterkanold.com/) +"This font is free to use for all personal and commercial applications. Copying and redistribution of the font is encouraged. Credit to me as the creator of the font is appreciated but not necessary." + + +Modified 2023 for the FreeCAD CAx development system by WandererFan (wandererfan@gmail.com). Modifications are distributed under LGPL2 or later. + diff --git a/src/Mod/TechDraw/Gui/Resources/fonts/osifont-italic.ttf b/src/Mod/TechDraw/Gui/Resources/fonts/osifont-italic.ttf new file mode 100644 index 0000000000..fc57f1b0ed Binary files /dev/null and b/src/Mod/TechDraw/Gui/Resources/fonts/osifont-italic.ttf differ