APIs for passing KIFONT::FONT pointers around.
Also some clean-up and bug fixes.
This commit is contained in:
parent
dd6cd7d184
commit
ccb94fd1a7
|
@ -113,9 +113,9 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_TEXT* aText, CONTAINER_2D_B
|
||||||
bool isBold = aText->IsBold();
|
bool isBold = aText->IsBold();
|
||||||
int penWidth = aText->GetEffectiveTextPenWidth();
|
int penWidth = aText->GetEffectiveTextPenWidth();
|
||||||
|
|
||||||
GRText( nullptr, aText->GetTextPos(), dummy_color, aText->GetShownText(),
|
GRText( nullptr, aText->GetTextPos(), dummy_color, aText->GetShownText(), aText->GetTextAngle(),
|
||||||
aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(),
|
size, aText->GetHorizJustify(), aText->GetVertJustify(), penWidth, aText->IsItalic(),
|
||||||
penWidth, aText->IsItalic(), isBold, addTextSegmToContainer, &callbackData );
|
isBold, aText->GetFont(), addTextSegmToContainer, &callbackData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ void BOARD_ADAPTER::addFootprintShapesWithClearance( const FOOTPRINT* aFootprint
|
||||||
|
|
||||||
GRText( nullptr, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(),
|
GRText( nullptr, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(),
|
||||||
size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
|
size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
|
||||||
isBold, addTextSegmToContainer, &callbackData );
|
isBold, text->GetFont(), addTextSegmToContainer, &callbackData );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,6 +297,7 @@ set( PLUGINS_EAGLE_SRCS
|
||||||
)
|
)
|
||||||
|
|
||||||
set( FONT_SRCS
|
set( FONT_SRCS
|
||||||
|
font/font.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set( COMMON_SRCS
|
set( COMMON_SRCS
|
||||||
|
|
|
@ -51,9 +51,9 @@
|
||||||
#include <i18n_utility.h>
|
#include <i18n_utility.h>
|
||||||
#include <geometry/shape_segment.h>
|
#include <geometry/shape_segment.h>
|
||||||
#include <geometry/shape_compound.h>
|
#include <geometry/shape_compound.h>
|
||||||
|
#include <font/font.h>
|
||||||
#include <geometry/shape_poly_set.h>
|
#include <geometry/shape_poly_set.h>
|
||||||
|
|
||||||
|
|
||||||
#include <wx/debug.h> // for wxASSERT
|
#include <wx/debug.h> // for wxASSERT
|
||||||
#include <wx/string.h> // wxString, wxArrayString
|
#include <wx/string.h> // wxString, wxArrayString
|
||||||
#include <wx/gdicmn.h> // for wxPoint,wxSize
|
#include <wx/gdicmn.h> // for wxPoint,wxSize
|
||||||
|
@ -109,7 +109,8 @@ EDA_TEXT::EDA_TEXT( const wxString& text ) :
|
||||||
|
|
||||||
EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
|
EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
|
||||||
m_text( aText.m_text ),
|
m_text( aText.m_text ),
|
||||||
m_attributes( aText.m_attributes )
|
m_attributes( aText.m_attributes ),
|
||||||
|
m_pos( aText.m_pos )
|
||||||
{
|
{
|
||||||
cacheShownText();
|
cacheShownText();
|
||||||
}
|
}
|
||||||
|
@ -440,11 +441,10 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||||
|
|
||||||
void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCount ) const
|
void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCount ) const
|
||||||
{
|
{
|
||||||
wxPoint pos = GetTextPos(); // Position of first line of the
|
wxPoint pos = GetTextPos(); // Position of first line of the multiline text according
|
||||||
// multiline text according to
|
// to the center of the multiline text block
|
||||||
// the center of the multiline text block
|
|
||||||
|
|
||||||
wxPoint offset; // Offset to next line.
|
wxPoint offset; // Offset to next line.
|
||||||
|
|
||||||
offset.y = GetInterline();
|
offset.y = GetInterline();
|
||||||
|
|
||||||
|
@ -465,8 +465,7 @@ void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCoun
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rotate the position of the first line
|
// Rotate the position of the first line around the center of the multiline text block
|
||||||
// around the center of the multiline text block
|
|
||||||
RotatePoint( &pos, GetTextPos(), GetTextAngle() );
|
RotatePoint( &pos, GetTextPos(), GetTextAngle() );
|
||||||
|
|
||||||
// Rotate the offset lines to increase happened in the right direction
|
// Rotate the offset lines to increase happened in the right direction
|
||||||
|
@ -479,6 +478,7 @@ void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCoun
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||||
const COLOR4D& aColor, OUTLINE_MODE aFillMode,
|
const COLOR4D& aColor, OUTLINE_MODE aFillMode,
|
||||||
const wxString& aText, const wxPoint &aPos )
|
const wxString& aText, const wxPoint &aPos )
|
||||||
|
@ -495,7 +495,7 @@ void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoi
|
||||||
size.x = -size.x;
|
size.x = -size.x;
|
||||||
|
|
||||||
GRText( DC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
|
GRText( DC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
|
||||||
GetVertJustify(), penWidth, IsItalic(), IsBold() );
|
GetVertJustify(), penWidth, IsItalic(), IsBold(), GetFont() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -520,6 +520,15 @@ wxString EDA_TEXT::GetTextStyleName() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString EDA_TEXT::GetFontName() const
|
||||||
|
{
|
||||||
|
if( GetFont() )
|
||||||
|
return GetFont()->Name();
|
||||||
|
else
|
||||||
|
return wxEmptyString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EDA_TEXT::IsDefaultFormatting() const
|
bool EDA_TEXT::IsDefaultFormatting() const
|
||||||
{
|
{
|
||||||
return ( IsVisible()
|
return ( IsVisible()
|
||||||
|
@ -530,6 +539,7 @@ bool EDA_TEXT::IsDefaultFormatting() const
|
||||||
&& !IsItalic()
|
&& !IsItalic()
|
||||||
&& !IsBold()
|
&& !IsBold()
|
||||||
&& !IsMultilineAllowed()
|
&& !IsMultilineAllowed()
|
||||||
|
&& GetFontName().IsEmpty()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,14 +637,14 @@ std::vector<wxPoint> EDA_TEXT::TransformToSegmentList() const
|
||||||
wxString txt = strings_list.Item( ii );
|
wxString txt = strings_list.Item( ii );
|
||||||
GRText( nullptr, positions[ii], color, txt, GetDrawRotation(), size,
|
GRText( nullptr, positions[ii], color, txt, GetDrawRotation(), size,
|
||||||
GetDrawHorizJustify(), GetDrawVertJustify(), penWidth, IsItalic(), forceBold,
|
GetDrawHorizJustify(), GetDrawVertJustify(), penWidth, IsItalic(), forceBold,
|
||||||
addTextSegmToBuffer, &cornerBuffer );
|
GetFont(), addTextSegmToBuffer, &cornerBuffer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GRText( nullptr, GetDrawPos(), color, GetShownText(), GetDrawRotation(), size,
|
GRText( nullptr, GetDrawPos(), color, GetShownText(), GetDrawRotation(), size,
|
||||||
GetDrawHorizJustify(), GetDrawVertJustify(), penWidth, IsItalic(), forceBold,
|
GetDrawHorizJustify(), GetDrawVertJustify(), penWidth, IsItalic(), forceBold,
|
||||||
addTextSegmToBuffer, &cornerBuffer );
|
GetFont(), addTextSegmToBuffer, &cornerBuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
return cornerBuffer;
|
return cornerBuffer;
|
||||||
|
@ -679,6 +689,11 @@ int EDA_TEXT::Compare( const EDA_TEXT* aOther ) const
|
||||||
TEST( m_attributes.m_Multiline, aOther->m_attributes.m_Multiline );
|
TEST( m_attributes.m_Multiline, aOther->m_attributes.m_Multiline );
|
||||||
TEST( m_attributes.m_KeepUpright, aOther->m_attributes.m_KeepUpright );
|
TEST( m_attributes.m_KeepUpright, aOther->m_attributes.m_KeepUpright );
|
||||||
|
|
||||||
|
int val = GetFontName().Cmp( aOther->GetFontName() );
|
||||||
|
|
||||||
|
if( val != 0 )
|
||||||
|
return val;
|
||||||
|
|
||||||
return m_text.Cmp( aOther->m_text );
|
return m_text.Cmp( aOther->m_text );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021 Ola Rinta-Koski
|
||||||
|
* Copyright (C) 2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||||
|
*
|
||||||
|
* Font abstract base class
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <core/wx_stl_compat.h>
|
||||||
|
#include <font/font.h>
|
||||||
|
|
||||||
|
|
||||||
|
using namespace KIFONT;
|
||||||
|
|
||||||
|
FONT* FONT::s_defaultFont = nullptr;
|
||||||
|
std::map<wxString, FONT*> FONT::s_fontMap;
|
||||||
|
|
||||||
|
|
||||||
|
FONT::FONT()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString& FONT::Name() const
|
||||||
|
{
|
||||||
|
return m_fontName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <plotters/plotter.h>
|
#include <plotters/plotter.h>
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
#include <base_screen.h>
|
|
||||||
#include <math/util.h> // for KiROUND
|
#include <math/util.h> // for KiROUND
|
||||||
|
#include <font/font.h>
|
||||||
|
|
||||||
#include <basic_gal.h>
|
#include <basic_gal.h>
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
|
||||||
* Use a value min(aSize.x, aSize.y) / 5 for a bold text.
|
* Use a value min(aSize.x, aSize.y) / 5 for a bold text.
|
||||||
* @param aItalic is the true to simulate an italic font.
|
* @param aItalic is the true to simulate an italic font.
|
||||||
* @param aBold use true to use a bold font. Useful only with default width value (aWidth = 0).
|
* @param aBold use true to use a bold font. Useful only with default width value (aWidth = 0).
|
||||||
|
* @param aFont is the font to use, or nullptr for the KiCad stroke font
|
||||||
* @param aCallback( int x0, int y0, int xf, int yf, void* aData ) is a function called
|
* @param aCallback( int x0, int y0, int xf, int yf, void* aData ) is a function called
|
||||||
* (if non null) to draw each segment. used to draw 3D texts or for plotting.
|
* (if non null) to draw each segment. used to draw 3D texts or for plotting.
|
||||||
* NULL for normal drawings
|
* NULL for normal drawings
|
||||||
|
@ -128,7 +129,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
|
||||||
void GRText( wxDC* aDC, const wxPoint& aPos, const COLOR4D& aColor, const wxString& aText,
|
void GRText( wxDC* aDC, const wxPoint& aPos, const COLOR4D& aColor, const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient, const wxSize& aSize, enum GR_TEXT_H_ALIGN_T aH_justify,
|
const EDA_ANGLE& aOrient, const wxSize& aSize, enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold,
|
enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold,
|
||||||
void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
|
KIFONT::FONT* aFont, void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
|
||||||
void* aCallbackData, PLOTTER* aPlotter )
|
void* aCallbackData, PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
bool fill_mode = true;
|
bool fill_mode = true;
|
||||||
|
|
|
@ -828,18 +828,19 @@ bool containsNonAsciiChars( const wxString& string )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DXF_PLOTTER::Text( const wxPoint& aPos,
|
void DXF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed,
|
bool aMultilineAllowed,
|
||||||
void* aData )
|
KIFONT::FONT* aFont,
|
||||||
|
void* aData )
|
||||||
{
|
{
|
||||||
// Fix me: see how to use DXF text mode for multiline texts
|
// Fix me: see how to use DXF text mode for multiline texts
|
||||||
if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
|
if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
|
||||||
|
@ -852,8 +853,8 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
// output text as graphics.
|
// output text as graphics.
|
||||||
// Perhaps multiline texts could be handled as DXF text entity
|
// Perhaps multiline texts could be handled as DXF text entity
|
||||||
// but I do not want spend time about this (JPC)
|
// but I do not want spend time about this (JPC)
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
||||||
aItalic, aBold, aMultilineAllowed, aData );
|
aBold, aMultilineAllowed, aFont, aData );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1923,26 +1923,27 @@ void GERBER_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos, int aDiamete
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBER_PLOTTER::Text( const wxPoint& aPos,
|
void GERBER_PLOTTER::Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed,
|
bool aMultilineAllowed,
|
||||||
void* aData )
|
KIFONT::FONT* aFont,
|
||||||
|
void* aData )
|
||||||
{
|
{
|
||||||
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
||||||
|
|
||||||
if( gbr_metadata )
|
if( gbr_metadata )
|
||||||
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
|
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
|
||||||
|
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
|
||||||
aBold, aMultilineAllowed, aData );
|
aItalic, aBold, aMultilineAllowed, aFont, aData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -822,18 +822,19 @@ bool PDF_PLOTTER::EndPlot()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PDF_PLOTTER::Text( const wxPoint& aPos,
|
void PDF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed,
|
bool aMultilineAllowed,
|
||||||
void* aData )
|
KIFONT::FONT* aFont,
|
||||||
|
void* aData )
|
||||||
{
|
{
|
||||||
// PDF files do not like 0 sized texts which create broken files.
|
// PDF files do not like 0 sized texts which create broken files.
|
||||||
if( aSize.x == 0 || aSize.y == 0 )
|
if( aSize.x == 0 || aSize.y == 0 )
|
||||||
|
@ -873,7 +874,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
fputs( "Q\n", workFile );
|
fputs( "Q\n", workFile );
|
||||||
|
|
||||||
// Plot the stroked text (if requested)
|
// Plot the stroked text (if requested)
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
||||||
aItalic, aBold, aMultilineAllowed );
|
aBold, aMultilineAllowed, aFont );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -958,18 +958,19 @@ bool PS_PLOTTER::EndPlot()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PS_PLOTTER::Text( const wxPoint& aPos,
|
void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed,
|
bool aMultilineAllowed,
|
||||||
void* aData )
|
KIFONT::FONT* aFont,
|
||||||
|
void* aData )
|
||||||
{
|
{
|
||||||
SetCurrentLineWidth( aWidth );
|
SetCurrentLineWidth( aWidth );
|
||||||
SetColor( aColor );
|
SetColor( aColor );
|
||||||
|
@ -982,8 +983,8 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||||
fprintf( m_outputFile, "%s %g %g phantomshow\n", ps_test.c_str(), pos_dev.x, pos_dev.y );
|
fprintf( m_outputFile, "%s %g %g phantomshow\n", ps_test.c_str(), pos_dev.x, pos_dev.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
||||||
aItalic, aBold, aMultilineAllowed );
|
aBold, aMultilineAllowed, aFont, aData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -755,18 +755,19 @@ bool SVG_PLOTTER::EndPlot()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SVG_PLOTTER::Text( const wxPoint& aPos,
|
void SVG_PLOTTER::Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed,
|
bool aMultilineAllowed,
|
||||||
void* aData )
|
KIFONT::FONT* aFont,
|
||||||
|
void* aData )
|
||||||
{
|
{
|
||||||
setFillMode( FILL_T::NO_FILL );
|
setFillMode( FILL_T::NO_FILL );
|
||||||
SetColor( aColor );
|
SetColor( aColor );
|
||||||
|
@ -823,8 +824,8 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
||||||
fprintf( m_outputFile, "<g class=\"stroked-text\"><desc>%s</desc>\n",
|
fprintf( m_outputFile, "<g class=\"stroked-text\"><desc>%s</desc>\n",
|
||||||
TO_UTF8( XmlEsc( aText ) ) );
|
TO_UTF8( XmlEsc( aText ) ) );
|
||||||
|
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
||||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
aBold, aMultilineAllowed, aFont );
|
||||||
|
|
||||||
fputs( "</g>", m_outputFile );
|
fputs( "</g>", m_outputFile );
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
|
||||||
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
|
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
|
||||||
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
|
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
|
||||||
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
|
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
|
||||||
text->IsMultilineAllowed() );
|
text->IsMultilineAllowed(), text->GetFont() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -649,22 +649,23 @@ void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, int a
|
||||||
* @param aData is a parameter used by some plotters in SetCurrentLineWidth(),
|
* @param aData is a parameter used by some plotters in SetCurrentLineWidth(),
|
||||||
* not directly used here.
|
* not directly used here.
|
||||||
*/
|
*/
|
||||||
void PLOTTER::Text( const wxPoint& aPos,
|
void PLOTTER::Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aPenWidth,
|
int aPenWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed,
|
bool aMultilineAllowed,
|
||||||
void* aData )
|
KIFONT::FONT* aFont,
|
||||||
|
void* aData )
|
||||||
{
|
{
|
||||||
SetColor( aColor );
|
SetColor( aColor );
|
||||||
SetCurrentLineWidth( aPenWidth, aData );
|
SetCurrentLineWidth( aPenWidth, aData );
|
||||||
|
|
||||||
GRText( nullptr, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aPenWidth,
|
GRText( nullptr, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aPenWidth,
|
||||||
aItalic, aBold, nullptr, nullptr, this );
|
aItalic, aBold, aFont, nullptr, nullptr, this );
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||||
wxString text = aData ? *static_cast<wxString*>( aData ) : GetText();
|
wxString text = aData ? *static_cast<wxString*>( aData ) : GetText();
|
||||||
|
|
||||||
GRText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
|
GRText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
|
||||||
GetVertJustify(), penWidth, IsItalic(), IsBold() );
|
GetVertJustify(), penWidth, IsItalic(), IsBold(), GetFont() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -396,14 +396,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
x = x1 + aTextInside;
|
x = x1 + aTextInside;
|
||||||
GRText( DC, wxPoint( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL,
|
GRText( DC, wxPoint( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL,
|
||||||
PinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth,
|
PinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth,
|
||||||
false, false );
|
false, false, nullptr );
|
||||||
}
|
}
|
||||||
else // Orient == PIN_LEFT
|
else // Orient == PIN_LEFT
|
||||||
{
|
{
|
||||||
x = x1 - aTextInside;
|
x = x1 - aTextInside;
|
||||||
GRText( DC, wxPoint( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL,
|
GRText( DC, wxPoint( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL,
|
||||||
PinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth,
|
PinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth,
|
||||||
false, false );
|
false, false, nullptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint(( x1 + aPinPos.x) / 2, y1 - num_offset ), NumColor, number,
|
GRText( DC, wxPoint(( x1 + aPinPos.x) / 2, y1 - num_offset ), NumColor, number,
|
||||||
EDA_ANGLE::HORIZONTAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
EDA_ANGLE::HORIZONTAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
||||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false );
|
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Its a vertical line. */
|
else /* Its a vertical line. */
|
||||||
|
@ -425,14 +425,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize,
|
GRText( DC, wxPoint( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize,
|
||||||
GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false,
|
GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false,
|
||||||
false );
|
false, nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
|
GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
|
||||||
number, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
number, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
||||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false );
|
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* PIN_UP */
|
else /* PIN_UP */
|
||||||
|
@ -443,14 +443,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize,
|
GRText( DC, wxPoint( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize,
|
||||||
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false,
|
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false,
|
||||||
false );
|
false, nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
|
GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
|
||||||
number, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
number, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER,
|
||||||
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false );
|
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -465,14 +465,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
x = ( x1 + aPinPos.x) / 2;
|
x = ( x1 + aPinPos.x) / 2;
|
||||||
GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, name, EDA_ANGLE::HORIZONTAL,
|
GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, name, EDA_ANGLE::HORIZONTAL,
|
||||||
PinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
|
PinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
|
||||||
namePenWidth, false, false );
|
namePenWidth, false, false, nullptr );
|
||||||
}
|
}
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
x = ( x1 + aPinPos.x) / 2;
|
x = ( x1 + aPinPos.x) / 2;
|
||||||
GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, number, EDA_ANGLE::HORIZONTAL,
|
GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, number, EDA_ANGLE::HORIZONTAL,
|
||||||
PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth,
|
PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth,
|
||||||
false, false );
|
false, false, nullptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Its a vertical line. */
|
else /* Its a vertical line. */
|
||||||
|
@ -482,14 +482,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
y = ( y1 + aPinPos.y) / 2;
|
y = ( y1 + aPinPos.y) / 2;
|
||||||
GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, name, EDA_ANGLE::VERTICAL,
|
GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, name, EDA_ANGLE::VERTICAL,
|
||||||
PinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
|
PinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
|
||||||
namePenWidth, false, false );
|
namePenWidth, false, false, nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, number,
|
GRText( DC, wxPoint( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, number,
|
||||||
EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP,
|
EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP,
|
||||||
numPenWidth, false, false );
|
numPenWidth, false, false, nullptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,7 +335,7 @@ void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||||
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
|
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
|
||||||
|
|
||||||
GRText( DC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_H_ALIGN_CENTER,
|
GRText( DC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_H_ALIGN_CENTER,
|
||||||
GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold() );
|
GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(), GetFont() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
|
||||||
textpos = GetBoundingBox().Centre() + aOffset;
|
textpos = GetBoundingBox().Centre() + aOffset;
|
||||||
|
|
||||||
GRText( DC, textpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_H_ALIGN_CENTER,
|
GRText( DC, textpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_H_ALIGN_CENTER,
|
||||||
GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold() );
|
GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(), GetFont() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1813,9 +1813,10 @@ SCH_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol( const SYMBOL& aCads
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(
|
void CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
|
||||||
const ATTRIBUTE_LOCATION& aCadstarAttrLoc, const double& aComponentOrientationDeciDeg,
|
double aComponentOrientationDeciDeg,
|
||||||
bool aIsMirrored, SCH_FIELD* aKiCadField )
|
bool aIsMirrored,
|
||||||
|
SCH_FIELD* aKiCadField )
|
||||||
{
|
{
|
||||||
aKiCadField->SetPosition( getKiCadPoint( aCadstarAttrLoc.Position ) );
|
aKiCadField->SetPosition( getKiCadPoint( aCadstarAttrLoc.Position ) );
|
||||||
aKiCadField->SetVisible( true );
|
aKiCadField->SetVisible( true );
|
||||||
|
@ -2914,19 +2915,19 @@ void CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int
|
||||||
for( auto& pin : pins )
|
for( auto& pin : pins )
|
||||||
{
|
{
|
||||||
auto setPinOrientation =
|
auto setPinOrientation =
|
||||||
[&]( double aAngleRad )
|
[&]( double aAngleRad )
|
||||||
{
|
{
|
||||||
int oDeg = (int) NormalizeAngle180( RAD2DEG( aAngleRad ) );
|
int oDeg = (int) NormalizeAngle180( RAD2DEG( aAngleRad ) );
|
||||||
|
|
||||||
if( oDeg >= -45 && oDeg <= 45 )
|
if( oDeg >= -45 && oDeg <= 45 )
|
||||||
pin->SetOrientation( 'R' ); // 0 degrees
|
pin->SetOrientation( 'R' ); // 0 degrees
|
||||||
else if( oDeg >= 45 && oDeg <= 135 )
|
else if( oDeg >= 45 && oDeg <= 135 )
|
||||||
pin->SetOrientation( 'U' ); // 90 degrees
|
pin->SetOrientation( 'U' ); // 90 degrees
|
||||||
else if( oDeg >= 135 || oDeg <= -135 )
|
else if( oDeg >= 135 || oDeg <= -135 )
|
||||||
pin->SetOrientation( 'L' ); // 180 degrees
|
pin->SetOrientation( 'L' ); // 180 degrees
|
||||||
else
|
else
|
||||||
pin->SetOrientation( 'D' ); // -90 degrees
|
pin->SetOrientation( 'D' ); // -90 degrees
|
||||||
};
|
};
|
||||||
|
|
||||||
if( uniqueSegments.count( pin->GetPosition() ) )
|
if( uniqueSegments.count( pin->GetPosition() ) )
|
||||||
{
|
{
|
||||||
|
@ -2946,8 +2947,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::pair<wxPoint, wxSize> CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad(
|
std::pair<wxPoint, wxSize>
|
||||||
const FIGURE& aCadstarFigure )
|
CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( const FIGURE& aCadstarFigure )
|
||||||
{
|
{
|
||||||
wxPoint upperLeft( Assignments.Settings.DesignLimit.x, 0 );
|
wxPoint upperLeft( Assignments.Settings.DesignLimit.x, 0 );
|
||||||
wxPoint lowerRight( 0, Assignments.Settings.DesignLimit.y );
|
wxPoint lowerRight( 0, Assignments.Settings.DesignLimit.y );
|
||||||
|
|
|
@ -153,7 +153,7 @@ private:
|
||||||
double& aComponentOrientationDeciDeg );
|
double& aComponentOrientationDeciDeg );
|
||||||
|
|
||||||
void loadSymbolFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
|
void loadSymbolFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
|
||||||
const double& aComponentOrientationDeciDeg, bool aIsMirrored,
|
double aComponentOrientationDeciDeg, bool aIsMirrored,
|
||||||
SCH_FIELD* aKiCadField );
|
SCH_FIELD* aKiCadField );
|
||||||
|
|
||||||
int getComponentOrientation( double aOrientAngleDeciDeg, double& aReturnedOrientationDeciDeg );
|
int getComponentOrientation( double aOrientAngleDeciDeg, double& aReturnedOrientationDeciDeg );
|
||||||
|
|
|
@ -211,17 +211,16 @@ public:
|
||||||
EDA_ANGLE KeepUpright() const;
|
EDA_ANGLE KeepUpright() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// value is always stored in 1/10ths of a degree
|
|
||||||
int m_value;
|
|
||||||
|
|
||||||
double m_radians; //< only used with as-radians constructor
|
|
||||||
|
|
||||||
ANGLE_TYPE m_initial_type;
|
|
||||||
|
|
||||||
void normalize( bool n720 = false );
|
void normalize( bool n720 = false );
|
||||||
int normalize( int aValue, ANGLE_TYPE aAngleType, bool n720 = false ) const;
|
int normalize( int aValue, ANGLE_TYPE aAngleType, bool n720 = false ) const;
|
||||||
double normalize( double aValue, ANGLE_TYPE aAngleType, bool n720 = false ) const;
|
double normalize( double aValue, ANGLE_TYPE aAngleType, bool n720 = false ) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
int m_value; ///< value is always stored in 1/10ths of a degree
|
||||||
|
double m_radians; ///< only used with as-radians constructor
|
||||||
|
ANGLE_TYPE m_initial_type;
|
||||||
|
|
||||||
static constexpr int TENTHS_OF_A_DEGREE_FULL_CIRCLE = 3600;
|
static constexpr int TENTHS_OF_A_DEGREE_FULL_CIRCLE = 3600;
|
||||||
static constexpr int DEGREES_FULL_CIRCLE = 360;
|
static constexpr int DEGREES_FULL_CIRCLE = 360;
|
||||||
static constexpr double RADIANS_FULL_CIRCLE = 2 * M_PI;
|
static constexpr double RADIANS_FULL_CIRCLE = 2 * M_PI;
|
||||||
|
|
|
@ -176,6 +176,9 @@ public:
|
||||||
void SetHorizJustify( GR_TEXT_H_ALIGN_T aType ) { m_attributes.m_Halign = aType; };
|
void SetHorizJustify( GR_TEXT_H_ALIGN_T aType ) { m_attributes.m_Halign = aType; };
|
||||||
void SetVertJustify( GR_TEXT_V_ALIGN_T aType ) { m_attributes.m_Valign = aType; };
|
void SetVertJustify( GR_TEXT_V_ALIGN_T aType ) { m_attributes.m_Valign = aType; };
|
||||||
|
|
||||||
|
void SetKeepUpright( bool aKeepUpright ) { m_attributes.m_KeepUpright = aKeepUpright; }
|
||||||
|
bool IsKeepUpright() const { return m_attributes.m_KeepUpright; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the text attributes from another instance.
|
* Set the text attributes from another instance.
|
||||||
*/
|
*/
|
||||||
|
@ -203,6 +206,14 @@ public:
|
||||||
|
|
||||||
bool IsDefaultFormatting() const;
|
bool IsDefaultFormatting() const;
|
||||||
|
|
||||||
|
void SetFont( KIFONT::FONT* aFont ) { m_attributes.m_Font = aFont; }
|
||||||
|
KIFONT::FONT* GetFont() const { return m_attributes.m_Font; }
|
||||||
|
|
||||||
|
wxString GetFontName() const;
|
||||||
|
|
||||||
|
void SetLineSpacing( double aLineSpacing ) { m_attributes.m_LineSpacing = aLineSpacing; }
|
||||||
|
double GetLineSpacing() const { return m_attributes.m_LineSpacing; }
|
||||||
|
|
||||||
void SetTextSize( const wxSize& aNewSize ) { m_attributes.m_Size = aNewSize; }
|
void SetTextSize( const wxSize& aNewSize ) { m_attributes.m_Size = aNewSize; }
|
||||||
wxSize GetTextSize() const { return wxSize( m_attributes.m_Size.x,
|
wxSize GetTextSize() const { return wxSize( m_attributes.m_Size.x,
|
||||||
m_attributes.m_Size.y ); }
|
m_attributes.m_Size.y ); }
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021 Ola Rinta-Koski
|
||||||
|
* Copyright (C) 2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||||
|
*
|
||||||
|
* Font abstract base class
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FONT_H_
|
||||||
|
#define FONT_H_
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <map>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <wx/string.h>
|
||||||
|
|
||||||
|
#include <utf8.h>
|
||||||
|
#include <font/text_attributes.h>
|
||||||
|
|
||||||
|
namespace KIGFX
|
||||||
|
{
|
||||||
|
class GAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum TEXT_STYLE
|
||||||
|
{
|
||||||
|
BOLD = 1,
|
||||||
|
ITALIC = 1 << 1,
|
||||||
|
SUBSCRIPT = 1 << 2,
|
||||||
|
SUPERSCRIPT = 1 << 3,
|
||||||
|
OVERBAR = 1 << 4
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
using TEXT_STYLE_FLAGS = unsigned int;
|
||||||
|
|
||||||
|
|
||||||
|
inline bool IsBold( TEXT_STYLE_FLAGS aFlags )
|
||||||
|
{
|
||||||
|
return aFlags & TEXT_STYLE::BOLD;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool IsItalic( TEXT_STYLE_FLAGS aFlags )
|
||||||
|
{
|
||||||
|
return aFlags & TEXT_STYLE::ITALIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool IsSuperscript( TEXT_STYLE_FLAGS aFlags )
|
||||||
|
{
|
||||||
|
return aFlags & TEXT_STYLE::SUPERSCRIPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool IsSubscript( TEXT_STYLE_FLAGS aFlags )
|
||||||
|
{
|
||||||
|
return aFlags & TEXT_STYLE::SUBSCRIPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool IsOverbar( TEXT_STYLE_FLAGS aFlags )
|
||||||
|
{
|
||||||
|
return aFlags & TEXT_STYLE::OVERBAR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string TextStyleAsString( TEXT_STYLE_FLAGS aFlags );
|
||||||
|
|
||||||
|
|
||||||
|
namespace KIFONT
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* FONT is an abstract base class for both outline and stroke fonts
|
||||||
|
*/
|
||||||
|
class FONT
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit FONT();
|
||||||
|
|
||||||
|
virtual ~FONT()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual bool IsStroke() const { return false; }
|
||||||
|
virtual bool IsOutline() const { return false; }
|
||||||
|
virtual bool IsBold() const { return false; }
|
||||||
|
virtual bool IsItalic() const { return false; }
|
||||||
|
|
||||||
|
const wxString& Name() const;
|
||||||
|
inline const char* NameAsToken() const { return Name().utf8_str().data(); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxString m_fontName; ///< Font name
|
||||||
|
wxString m_fontFileName; ///< Font file name
|
||||||
|
|
||||||
|
private:
|
||||||
|
static FONT* s_defaultFont;
|
||||||
|
static std::map<wxString, FONT*> s_fontMap;
|
||||||
|
};
|
||||||
|
} //namespace KIFONT
|
||||||
|
|
||||||
|
|
||||||
|
inline std::ostream& operator<<(std::ostream& os, const KIFONT::FONT& aFont)
|
||||||
|
{
|
||||||
|
os << "[Font \"" << aFont.Name() << "\"" << ( aFont.IsStroke() ? " stroke" : "" )
|
||||||
|
<< ( aFont.IsOutline() ? " outline" : "" ) << ( aFont.IsBold() ? " bold" : "" )
|
||||||
|
<< ( aFont.IsItalic() ? " italic" : "" ) << "]";
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline std::ostream& operator<<(std::ostream& os, const KIFONT::FONT* aFont)
|
||||||
|
{
|
||||||
|
os << *aFont;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FONT_H_
|
|
@ -101,6 +101,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
|
||||||
* for a bold text.
|
* for a bold text.
|
||||||
* @param aItalic true to simulate an italic font.
|
* @param aItalic true to simulate an italic font.
|
||||||
* @param aBold true to use a bold font.
|
* @param aBold true to use a bold font.
|
||||||
|
* @param aFont is the font to use, or nullptr for the KiCad stroke font
|
||||||
* @param aCallback ( int x0, int y0, int xf, int yf, void* aData ) is a function called
|
* @param aCallback ( int x0, int y0, int xf, int yf, void* aData ) is a function called
|
||||||
* (if non null) to draw each segment. used to draw 3D texts or for plotting.
|
* (if non null) to draw each segment. used to draw 3D texts or for plotting.
|
||||||
* NULL for normal drawings.
|
* NULL for normal drawings.
|
||||||
|
@ -112,6 +113,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
|
||||||
void GRText( wxDC* aDC, const wxPoint& aPos, const KIGFX::COLOR4D& aColor, const wxString& aText,
|
void GRText( wxDC* aDC, const wxPoint& aPos, const KIGFX::COLOR4D& aColor, const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient, const wxSize& aSize, enum GR_TEXT_H_ALIGN_T aH_justify,
|
const EDA_ANGLE& aOrient, const wxSize& aSize, enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold,
|
enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold,
|
||||||
|
KIFONT::FONT* aFont,
|
||||||
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
|
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
|
||||||
void* aCallbackData = nullptr, PLOTTER* aPlotter = nullptr );
|
void* aCallbackData = nullptr, PLOTTER* aPlotter = nullptr );
|
||||||
|
|
||||||
|
|
|
@ -399,18 +399,19 @@ public:
|
||||||
* For convenience it accept the color to use for specific plotters (GERBER) aData is used
|
* For convenience it accept the color to use for specific plotters (GERBER) aData is used
|
||||||
* to pass extra parameters.
|
* to pass extra parameters.
|
||||||
*/
|
*/
|
||||||
virtual void Text( const wxPoint& aPos,
|
virtual void Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed = false,
|
bool aMultilineAllowed = false,
|
||||||
void* aData = nullptr );
|
KIFONT::FONT* aFont = nullptr,
|
||||||
|
void* aData = nullptr );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw a marker (used for the drill map).
|
* Draw a marker (used for the drill map).
|
||||||
|
|
|
@ -149,18 +149,19 @@ public:
|
||||||
virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
|
virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
|
||||||
double aOrient, OUTLINE_MODE aTraceMode, void* aData ) override;
|
double aOrient, OUTLINE_MODE aTraceMode, void* aData ) override;
|
||||||
|
|
||||||
virtual void Text( const wxPoint& aPos,
|
virtual void Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed = false,
|
bool aMultilineAllowed = false,
|
||||||
void* aData = nullptr ) override;
|
KIFONT::FONT* aFont = nullptr,
|
||||||
|
void* aData = nullptr ) override;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -99,18 +99,19 @@ public:
|
||||||
|
|
||||||
virtual void PenTo( const wxPoint& pos, char plume ) override;
|
virtual void PenTo( const wxPoint& pos, char plume ) override;
|
||||||
|
|
||||||
virtual void Text( const wxPoint& aPos,
|
virtual void Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed = false,
|
bool aMultilineAllowed = false,
|
||||||
void* aData = nullptr ) override;
|
KIFONT::FONT* aFont = nullptr,
|
||||||
|
void* aData = nullptr ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filled circular flashes are stored as apertures
|
* Filled circular flashes are stored as apertures
|
||||||
|
|
|
@ -214,18 +214,19 @@ public:
|
||||||
double aScaleFactor ) override;
|
double aScaleFactor ) override;
|
||||||
|
|
||||||
virtual void PenTo( const wxPoint& pos, char plume ) override;
|
virtual void PenTo( const wxPoint& pos, char plume ) override;
|
||||||
virtual void Text( const wxPoint& aPos,
|
virtual void Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed = false,
|
bool aMultilineAllowed = false,
|
||||||
void* aData = nullptr ) override;
|
KIFONT::FONT* aFont = nullptr,
|
||||||
|
void* aData = nullptr ) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void emitSetRGBColor( double r, double g, double b ) override;
|
virtual void emitSetRGBColor( double r, double g, double b ) override;
|
||||||
|
@ -331,18 +332,19 @@ public:
|
||||||
|
|
||||||
virtual void PenTo( const wxPoint& pos, char plume ) override;
|
virtual void PenTo( const wxPoint& pos, char plume ) override;
|
||||||
|
|
||||||
virtual void Text( const wxPoint& aPos,
|
virtual void Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed = false,
|
bool aMultilineAllowed = false,
|
||||||
void* aData = nullptr ) override;
|
KIFONT::FONT* aFont = nullptr,
|
||||||
|
void* aData = nullptr ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PDF images are handles as inline, not XObject streams...
|
* PDF images are handles as inline, not XObject streams...
|
||||||
|
@ -494,18 +496,19 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void EndBlock( void* aData ) override;
|
virtual void EndBlock( void* aData ) override;
|
||||||
|
|
||||||
virtual void Text( const wxPoint& aPos,
|
virtual void Text( const wxPoint& aPos,
|
||||||
const COLOR4D& aColor,
|
const COLOR4D& aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
const EDA_ANGLE& aOrient,
|
const EDA_ANGLE& aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum GR_TEXT_H_ALIGN_T aH_justify,
|
enum GR_TEXT_H_ALIGN_T aH_justify,
|
||||||
enum GR_TEXT_V_ALIGN_T aV_justify,
|
enum GR_TEXT_V_ALIGN_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
bool aMultilineAllowed = false,
|
bool aMultilineAllowed = false,
|
||||||
void* aData = nullptr ) override;
|
KIFONT::FONT* aFont = nullptr,
|
||||||
|
void* aData = nullptr ) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -476,7 +476,7 @@ void FP_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerB
|
||||||
size.x = -size.x;
|
size.x = -size.x;
|
||||||
|
|
||||||
GRText( nullptr, GetTextPos(), BLACK, GetShownText(), GetDrawRotation(), size,
|
GRText( nullptr, GetTextPos(), BLACK, GetShownText(), GetDrawRotation(), size,
|
||||||
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold(),
|
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold(), GetFont(),
|
||||||
addTextSegmToPoly, &prms );
|
addTextSegmToPoly, &prms );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,7 @@ void PCB_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCorner
|
||||||
COLOR4D color; // not actually used, but needed by GRText
|
COLOR4D color; // not actually used, but needed by GRText
|
||||||
|
|
||||||
GRText( nullptr, GetTextPos(), color, GetShownText(), GetTextAngle(), size, GetHorizJustify(),
|
GRText( nullptr, GetTextPos(), color, GetShownText(), GetTextAngle(), size, GetHorizJustify(),
|
||||||
GetVertJustify(), penWidth, IsItalic(), IsBold(), addTextSegmToPoly, &prms );
|
GetVertJustify(), penWidth, IsItalic(), IsBold(), GetFont(), addTextSegmToPoly, &prms );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -377,7 +377,7 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aTextMod, const COLOR4D& aColor )
|
void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aText, const COLOR4D& aColor )
|
||||||
{
|
{
|
||||||
COLOR4D color = aColor;
|
COLOR4D color = aColor;
|
||||||
|
|
||||||
|
@ -387,11 +387,11 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aTextMod, const COL
|
||||||
m_plotter->SetColor( color );
|
m_plotter->SetColor( color );
|
||||||
|
|
||||||
// calculate some text parameters :
|
// calculate some text parameters :
|
||||||
wxSize size = aTextMod->GetTextSize();
|
wxSize size = aText->GetTextSize();
|
||||||
wxPoint pos = aTextMod->GetTextPos();
|
wxPoint pos = aText->GetTextPos();
|
||||||
int thickness = aTextMod->GetEffectiveTextPenWidth();
|
int thickness = aText->GetEffectiveTextPenWidth();
|
||||||
|
|
||||||
if( aTextMod->IsMirrored() )
|
if( aText->IsMirrored() )
|
||||||
size.x = -size.x; // Text is mirrored
|
size.x = -size.x; // Text is mirrored
|
||||||
|
|
||||||
// Non bold texts thickness is clamped at 1/6 char size by the low level draw function.
|
// Non bold texts thickness is clamped at 1/6 char size by the low level draw function.
|
||||||
|
@ -402,18 +402,18 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aTextMod, const COL
|
||||||
|
|
||||||
GBR_METADATA gbr_metadata;
|
GBR_METADATA gbr_metadata;
|
||||||
|
|
||||||
if( IsCopperLayer( aTextMod->GetLayer() ) )
|
if( IsCopperLayer( aText->GetLayer() ) )
|
||||||
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR );
|
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR );
|
||||||
|
|
||||||
gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP );
|
gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP );
|
||||||
const FOOTPRINT* parent = static_cast<const FOOTPRINT*> ( aTextMod->GetParent() );
|
const FOOTPRINT* parent = static_cast<const FOOTPRINT*> ( aText->GetParent() );
|
||||||
gbr_metadata.SetCmpReference( parent->GetReference() );
|
gbr_metadata.SetCmpReference( parent->GetReference() );
|
||||||
|
|
||||||
m_plotter->SetCurrentLineWidth( thickness );
|
m_plotter->SetCurrentLineWidth( thickness );
|
||||||
|
|
||||||
m_plotter->Text( pos, aColor, aTextMod->GetShownText(), aTextMod->GetDrawRotation(), size,
|
m_plotter->Text( pos, aColor, aText->GetShownText(), aText->GetDrawRotation(), size,
|
||||||
aTextMod->GetHorizJustify(), aTextMod->GetVertJustify(), thickness,
|
aText->GetHorizJustify(), aText->GetVertJustify(), thickness,
|
||||||
aTextMod->IsItalic(), allow_bold, false, &gbr_metadata );
|
aText->IsItalic(), allow_bold, false, aText->GetFont(), &gbr_metadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -783,14 +783,16 @@ void BRDITEMS_PLOTTER::PlotPcbText( const PCB_TEXT* aText )
|
||||||
wxString& txt = strings_list.Item( ii );
|
wxString& txt = strings_list.Item( ii );
|
||||||
m_plotter->Text( positions[ii], color, txt, aText->GetTextAngle(), size,
|
m_plotter->Text( positions[ii], color, txt, aText->GetTextAngle(), size,
|
||||||
aText->GetHorizJustify(), aText->GetVertJustify(), thickness,
|
aText->GetHorizJustify(), aText->GetVertJustify(), thickness,
|
||||||
aText->IsItalic(), allow_bold, false, &gbr_metadata );
|
aText->IsItalic(), allow_bold, false, aText->GetFont(),
|
||||||
|
&gbr_metadata );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_plotter->Text( pos, color, shownText, aText->GetTextAngle(), size,
|
m_plotter->Text( pos, color, shownText, aText->GetTextAngle(), size,
|
||||||
aText->GetHorizJustify(), aText->GetVertJustify(), thickness,
|
aText->GetHorizJustify(), aText->GetVertJustify(), thickness,
|
||||||
aText->IsItalic(), allow_bold, false, &gbr_metadata );
|
aText->IsItalic(), allow_bold, false, aText->GetFont(),
|
||||||
|
&gbr_metadata );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue