EgtGeomKernel 1.5f1 :
- aggiunta entità testo (con font Nfe e di sistema) - in tutte le rotate ora l'angolo è in gradi - aggiunta trasformazione Shear (scorrimento) - aggiunta trsformazione LocToLoc - Set/GetInfo specializzate per i diversi tipi di informazioni - Copy e Relocate con possibilità di indicare l'entità di riferimento rispetto a cui inserire - aggiunte trasformazioni a PolyLine.
This commit is contained in:
+130
@@ -0,0 +1,130 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : FontManager.cpp Data : 28.05.14 Versione : 1.5f1
|
||||
// Contenuto : Implementazione della classe FontManager.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.05.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "FontManager.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EgnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgnFileUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::Init( const std::string& sNfeFontDir, const std::string& sDefaultFont)
|
||||
{
|
||||
// assegno direttorio file per font Nfe
|
||||
m_sNfeFontDir = sNfeFontDir ;
|
||||
TrimRight( m_sNfeFontDir, " \\") ;
|
||||
// assegno nome font di default
|
||||
m_sDefaultFont = sDefaultFont ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::SetCurrFont( const std::string& sFont, int nWeight, bool bItalic,
|
||||
double dHeight, double dRatio, double dAddAdvance)
|
||||
{
|
||||
// gestione font di default
|
||||
string sTFont = (( sFont.empty()) ? m_sDefaultFont : sFont) ;
|
||||
// lo cerco tra i font Nfe
|
||||
if ( FileExtensionMatches( sTFont, "NFE")) {
|
||||
m_bCurrNfeFont = true ;
|
||||
if ( ! m_NfeFont.SetCurrFont( m_sNfeFontDir + "\\" + sTFont, nWeight, bItalic,
|
||||
dHeight, dRatio, dAddAdvance))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti lo cerco tra i font di sistema
|
||||
else {
|
||||
m_bCurrNfeFont = false ;
|
||||
if ( ! m_OsFont.SetCurrFont( sTFont, nWeight, bItalic, dHeight, dRatio, dAddAdvance))
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::GetCapHeight( double& dCapH)
|
||||
{
|
||||
if ( m_bCurrNfeFont)
|
||||
return m_NfeFont.GetCapHeight( dCapH) ;
|
||||
else
|
||||
return m_OsFont.GetCapHeight( dCapH) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::GetAscent( double& dAsc)
|
||||
{
|
||||
if ( m_bCurrNfeFont)
|
||||
return m_NfeFont.GetAscent( dAsc) ;
|
||||
else
|
||||
return m_OsFont.GetAscent( dAsc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::GetDescent( double& dDesc)
|
||||
{
|
||||
if ( m_bCurrNfeFont)
|
||||
return m_NfeFont.GetDescent( dDesc) ;
|
||||
else
|
||||
return m_OsFont.GetDescent( dDesc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::GetLength( const string& sText, double& dLen)
|
||||
{
|
||||
if ( m_bCurrNfeFont)
|
||||
return m_NfeFont.GetLength( sText, dLen) ;
|
||||
else
|
||||
return m_OsFont.GetLength( sText, dLen) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::GetBBox( const string& sText, BBox3d& b3Box)
|
||||
{
|
||||
if ( m_bCurrNfeFont)
|
||||
return m_NfeFont.GetBBox( sText, b3Box) ;
|
||||
else
|
||||
return m_OsFont.GetBBox( sText, b3Box) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::GetOutline( const string& sText, ICURVEPLIST& lstPC)
|
||||
{
|
||||
if ( m_bCurrNfeFont)
|
||||
return m_NfeFont.GetOutline( sText, lstPC) ;
|
||||
else
|
||||
return m_OsFont.GetOutline( sText, lstPC) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::ApproxWithLines( const string& sText, double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL)
|
||||
{
|
||||
if ( m_bCurrNfeFont)
|
||||
return m_NfeFont.ApproxWithLines( sText, dLinTol, dAngTolDeg, lstPL) ;
|
||||
else
|
||||
return m_OsFont.ApproxWithLines( sText, dLinTol, dAngTolDeg, lstPL) ;
|
||||
}
|
||||
Reference in New Issue
Block a user