Include osifont in TechDraw

- also use PropertyFont instead of PropertyString
This commit is contained in:
WandererFan
2017-08-24 20:12:41 -04:00
committed by wmayer
parent caace9d617
commit 15be0f285e
7 changed files with 32 additions and 3 deletions

View File

@@ -48,7 +48,7 @@ public:
virtual ~DrawViewAnnotation();
App::PropertyStringList Text;
App::PropertyString Font;
App::PropertyFont Font;
App::PropertyColor TextColor;
App::PropertyInteger TextSize;
App::PropertyInteger LineSpace;

View File

@@ -186,6 +186,7 @@ App::DocumentObjectExecReturn *DrawViewDimension::execute(void)
}
//TODO: if MeasureType = Projected and the Projected shape changes, the Dimension may become invalid (see tilted Cube example)
requestPaint();
return App::DocumentObject::execute();;
}

View File

@@ -59,7 +59,7 @@ public:
App::PropertyEnumeration Type; //DistanceX,DistanceY,Diameter, etc
/// Properties for Visualisation
App::PropertyString Font;
App::PropertyFont Font;
App::PropertyFloat Fontsize;
App::PropertyString FormatSpec;
App::PropertyFloat LineWidth;

View File

@@ -49,7 +49,7 @@ public:
App::PropertyLink Source;
App::PropertyString CellStart;
App::PropertyString CellEnd;
App::PropertyString Font;
App::PropertyFont Font;
App::PropertyColor TextColor;
App::PropertyFloat LineWidth;
App::PropertyFloat TextSize;

View File

@@ -30,6 +30,7 @@
#include <Base/Console.h>
#include <Base/PyObjectBase.h>
#include <Base/Interpreter.h>
#include <Base/Tools.h>
#include <Gui/Application.h>
#include <Gui/Language/Translator.h>
@@ -66,6 +67,15 @@ void loadTechDrawResource()
// add resources and reloads the translators
Q_INIT_RESOURCE(TechDraw);
Gui::Translator::instance()->refresh();
// add osifont
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().Log("TechDraw failed to load osifont file: %d from: %s\n",rc,qPrintable(fontFile));
}
}
namespace TechDrawGui {

View File

@@ -246,6 +246,15 @@ fc_copy_sources(TechDrawGui "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Te
INSTALL(FILES ${TechDrawGuiIcon_SVG} DESTINATION "${CMAKE_INSTALL_DATADIR}/Mod/TechDraw/Resources/icons")
##install OSIFONT
SET(TechDrawGuiFonts
Resources/fonts/osifont-lgpl3fe.ttf
Resources/fonts/osifont.license
)
fc_copy_sources(TechDrawGui "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/TechDraw" ${TechDrawGuiFonts})
INSTALL(FILES ${TechDrawGuiFonts} DESTINATION "${CMAKE_INSTALL_DATADIR}/Mod/TechDraw/Resources/fonts")
SET_BIN_DIR(TechDrawGui TechDrawGui /Mod/TechDraw)
SET_PYTHON_PREFIX_SUFFIX(TechDrawGui)

View File

@@ -0,0 +1,9 @@
osifont license:
osifont-lgpl3fe.ttf is used under one or more of the following licenses:
- GNU GPL licence version 3 with GPL font exception,
- GNU GPL licence version 2 with GPL font exception,
- GNU LGPL licence version 3 with GPL font exception.
https://github.com/hikikomori82/osifont/