[TD]add ANSI Y14.5 compatible font
- also add osifont-italic - update osifont to latest version
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QFontDatabase>
|
||||
#include <QFontDatabase>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
@@ -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<std::string> 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<TechDrawGui::DlgPrefsTechDrawGeneralImp> ("TechDraw"); //General
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawScaleImp> ("TechDraw"); //Scale
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawDimensionsImp>("TechDraw"); //Dimensions
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawAnnotationImp> ("TechDraw"); //Annotation
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawColorsImp>("TechDraw"); //Colors
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawHLRImp> ("TechDraw"); //HLR
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawAdvancedImp> ("TechDraw"); //Advanced
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawGeneralImp>("TechDraw"); //General
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawScaleImp>("TechDraw"); //Scale
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawDimensionsImp>("TechDraw");//Dimensions
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawAnnotationImp>("TechDraw");//Annotation
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawColorsImp>("TechDraw"); //Colors
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawHLRImp>("TechDraw"); //HLR
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawAdvancedImp>("TechDraw"); //Advanced
|
||||
|
||||
// add resources and reloads the translators
|
||||
loadTechDrawResource();
|
||||
|
||||
@@ -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)
|
||||
|
||||
BIN
src/Mod/TechDraw/Gui/Resources/fonts/Y14.5-2018.ttf
Normal file
BIN
src/Mod/TechDraw/Gui/Resources/fonts/Y14.5-2018.ttf
Normal file
Binary file not shown.
BIN
src/Mod/TechDraw/Gui/Resources/fonts/Y14.5-FreeCAD.ttf
Normal file
BIN
src/Mod/TechDraw/Gui/Resources/fonts/Y14.5-FreeCAD.ttf
Normal file
Binary file not shown.
8
src/Mod/TechDraw/Gui/Resources/fonts/Y14.5Font.license
Normal file
8
src/Mod/TechDraw/Gui/Resources/fonts/Y14.5Font.license
Normal file
@@ -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.
|
||||
|
||||
BIN
src/Mod/TechDraw/Gui/Resources/fonts/osifont-italic.ttf
Normal file
BIN
src/Mod/TechDraw/Gui/Resources/fonts/osifont-italic.ttf
Normal file
Binary file not shown.
Reference in New Issue
Block a user