Move default font to RENDER_SETTINGS.
Fixes https://gitlab.com/kicad/code/kicad/issues/12723
This commit is contained in:
parent
d78b41969f
commit
cef7cd8f7c
|
@ -67,9 +67,12 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
|
|||
const BOARD_ITEM* aOwner )
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
KIFONT::FONT* font = aText->GetDrawFont();
|
||||
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
|
||||
float penWidth_3DU = TO_3DU( aText->GetEffectiveTextPenWidth() );
|
||||
KIFONT::FONT* font = aText->GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( wxEmptyString, aText->IsBold(), aText->IsItalic() );
|
||||
|
||||
if( aOwner && aOwner->IsKnockout() )
|
||||
{
|
||||
|
|
|
@ -252,7 +252,10 @@ void KIGFX::DS_PAINTER::draw( const DS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
|
|||
KIFONT::FONT* font = aItem->GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( wxEmptyString, aItem->IsBold(), aItem->IsItalic() );
|
||||
{
|
||||
font = KIFONT::FONT::GetFont( m_renderSettings.GetDefaultFont(), aItem->IsBold(),
|
||||
aItem->IsItalic() );
|
||||
}
|
||||
|
||||
const COLOR4D& color = m_renderSettings.GetColor( aItem, aLayer );
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ void DS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
|
|||
ws_settings->SetSelectedColor( settings->GetLayerColor( LAYER_SELECT_OVERLAY ) );
|
||||
ws_settings->SetBrightenedColor( settings->GetLayerColor( LAYER_BRIGHTENED ) );
|
||||
ws_settings->SetPageBorderColor( settings->GetLayerColor( m_pageBorderColorLayer ) );
|
||||
ws_settings->SetDefaultFont( settings->GetDefaultFont() );
|
||||
|
||||
// Draw all the components that make the drawing sheet
|
||||
for( DS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
|
||||
|
|
|
@ -423,7 +423,7 @@ void EDA_TEXT::cacheShownText()
|
|||
}
|
||||
|
||||
|
||||
KIFONT::FONT* EDA_TEXT::GetDrawFont() const
|
||||
KIFONT::FONT* EDA_TEXT::getDrawFont() const
|
||||
{
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
|
@ -448,9 +448,10 @@ void EDA_TEXT::ClearBoundingBoxCache()
|
|||
|
||||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>*
|
||||
EDA_TEXT::GetRenderCache( const wxString& forResolvedText, const VECTOR2I& aOffset ) const
|
||||
EDA_TEXT::GetRenderCache( const KIFONT::FONT* aFont, const wxString& forResolvedText,
|
||||
const VECTOR2I& aOffset ) const
|
||||
{
|
||||
if( GetDrawFont()->IsOutline() )
|
||||
if( getDrawFont()->IsOutline() )
|
||||
{
|
||||
EDA_ANGLE resolvedAngle = GetDrawRotation();
|
||||
|
||||
|
@ -461,7 +462,7 @@ EDA_TEXT::GetRenderCache( const wxString& forResolvedText, const VECTOR2I& aOffs
|
|||
{
|
||||
m_render_cache.clear();
|
||||
|
||||
KIFONT::OUTLINE_FONT* font = static_cast<KIFONT::OUTLINE_FONT*>( GetDrawFont() );
|
||||
KIFONT::OUTLINE_FONT* font = static_cast<KIFONT::OUTLINE_FONT*>( getDrawFont() );
|
||||
TEXT_ATTRIBUTES attrs = GetAttributes();
|
||||
|
||||
attrs.m_Angle = resolvedAngle;
|
||||
|
@ -495,7 +496,7 @@ void EDA_TEXT::AddRenderCacheGlyph( const SHAPE_POLY_SET& aPoly )
|
|||
|
||||
int EDA_TEXT::GetInterline() const
|
||||
{
|
||||
return KiROUND( GetDrawFont()->GetInterline( GetTextHeight() ) );
|
||||
return KiROUND( getDrawFont()->GetInterline( GetTextHeight() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -530,7 +531,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
|||
}
|
||||
|
||||
// calculate the H and V size
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
KIFONT::FONT* font = getDrawFont();
|
||||
VECTOR2D fontSize( GetTextSize() );
|
||||
bool bold = IsBold();
|
||||
bool italic = IsItalic();
|
||||
|
@ -722,8 +723,13 @@ void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const VECTO
|
|||
if( IsMirrored() )
|
||||
size.x = -size.x;
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
GRPrintText( DC, aOffset + aPos, aColor, aText, GetDrawRotation(), size, GetHorizJustify(),
|
||||
GetVertJustify(), penWidth, IsItalic(), IsBold(), GetDrawFont() );
|
||||
GetVertJustify(), penWidth, IsItalic(), IsBold(), font );
|
||||
}
|
||||
|
||||
|
||||
|
@ -849,7 +855,7 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( bool aTriangula
|
|||
{
|
||||
std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
KIFONT::FONT* font = getDrawFont();
|
||||
int penWidth = GetEffectiveTextPenWidth();
|
||||
TEXT_ATTRIBUTES attrs = GetAttributes();
|
||||
|
||||
|
@ -946,7 +952,7 @@ void EDA_TEXT::TransformBoundingBoxToPolygon( SHAPE_POLY_SET* aBuffer, int aClea
|
|||
|
||||
// TrueType bounding boxes aren't guaranteed to include all descenders, diacriticals, etc.
|
||||
// Since we use this for zone knockouts and DRC, we need something more accurate.
|
||||
if( GetDrawFont()->IsOutline() )
|
||||
if( getDrawFont()->IsOutline() )
|
||||
rect = GetEffectiveTextShape( false, false )->BBox();
|
||||
|
||||
rect.Inflate( aClearance );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -23,13 +23,13 @@
|
|||
*/
|
||||
|
||||
#include <eda_item.h>
|
||||
#include <font/font.h>
|
||||
#include <plotters/plotter_dxf.h>
|
||||
#include <plotters/plotter_hpgl.h>
|
||||
#include <plotters/plotters_pslike.h>
|
||||
#include <plotters/plotter_gerber.h>
|
||||
#include <drawing_sheet/ds_data_item.h>
|
||||
#include <drawing_sheet/ds_draw_item.h>
|
||||
#include <drawing_sheet/ds_painter.h>
|
||||
#include <title_block.h>
|
||||
#include <wx/filename.h>
|
||||
|
||||
|
@ -65,9 +65,10 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
|
|||
{
|
||||
/* Note: Page sizes values are given in mils
|
||||
*/
|
||||
double iusPerMil = plotter->GetIUsPerDecimil() * 10.0;
|
||||
COLOR4D plotColor = plotter->GetColorMode() ? aColor : COLOR4D::BLACK;
|
||||
int defaultPenWidth = plotter->RenderSettings()->GetDefaultPenWidth();
|
||||
double iusPerMil = plotter->GetIUsPerDecimil() * 10.0;
|
||||
COLOR4D plotColor = plotter->GetColorMode() ? aColor : COLOR4D::BLACK;
|
||||
RENDER_SETTINGS* settings = plotter->RenderSettings();
|
||||
int defaultPenWidth = settings->GetDefaultPenWidth();
|
||||
|
||||
if( plotColor == COLOR4D::UNSPECIFIED )
|
||||
plotColor = COLOR4D( RED );
|
||||
|
@ -86,7 +87,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
|
|||
drawList.SetFileName( fn.GetFullName() ); // Print only the short filename
|
||||
drawList.SetSheetName( aSheetName );
|
||||
drawList.SetSheetPath( aSheetPath );
|
||||
drawList.SetSheetLayer( plotter->RenderSettings()->GetLayerName() );
|
||||
drawList.SetSheetLayer( settings->GetLayerName() );
|
||||
drawList.SetProject( aProject );
|
||||
drawList.SetIsFirstPage( aIsFirstPage );
|
||||
drawList.SetProperties( aProperties );
|
||||
|
@ -124,11 +125,20 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
|
|||
case WSG_TEXT_T:
|
||||
{
|
||||
DS_DRAW_ITEM_TEXT* text = (DS_DRAW_ITEM_TEXT*) item;
|
||||
KIFONT::FONT* font = text->GetFont();
|
||||
|
||||
if( !font )
|
||||
{
|
||||
font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), text->IsBold(),
|
||||
text->IsItalic() );
|
||||
}
|
||||
|
||||
int penWidth = std::max( text->GetEffectiveTextPenWidth(), defaultPenWidth );
|
||||
|
||||
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
|
||||
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
|
||||
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
|
||||
text->IsMultilineAllowed(), text->GetDrawFont() );
|
||||
text->IsMultilineAllowed(), font );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -344,6 +344,8 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions( RENDER_SETTINGS* aSettings )
|
|||
|
||||
// HPGL Pen Size is stored in mm in config
|
||||
cfg->m_PlotPanel.hpgl_pen_size = m_HPGLPenSize / schIUScale.IU_PER_MM;
|
||||
|
||||
aSettings->SetDefaultFont( cfg->m_Appearance.default_font );
|
||||
}
|
||||
|
||||
aSettings->LoadColors( colors );
|
||||
|
|
|
@ -516,6 +516,8 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
|
|||
renderSettings.SetLayerColor( LAYER_DRAWINGSHEET,
|
||||
renderSettings.GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) );
|
||||
|
||||
renderSettings.SetDefaultFont( cfg->m_Appearance.default_font );
|
||||
|
||||
if( printReference )
|
||||
{
|
||||
m_parent->PrintDrawingSheet( &renderSettings, aScreen, aScreen->Schematic()->GetProperties(),
|
||||
|
|
|
@ -150,6 +150,7 @@ void SCH_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
GetRenderSettings()->m_ShowPinsElectricalType = false;
|
||||
GetRenderSettings()->m_ShowPinNumbers = false;
|
||||
GetRenderSettings()->SetDefaultFont( eeconfig()->m_Appearance.default_font );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ int LIB_FIELD::GetPenWidth() const
|
|||
}
|
||||
|
||||
|
||||
KIFONT::FONT* LIB_FIELD::GetDrawFont() const
|
||||
KIFONT::FONT* LIB_FIELD::getDrawFont() const
|
||||
{
|
||||
KIFONT::FONT* font = EDA_TEXT::GetFont();
|
||||
|
||||
|
@ -154,8 +154,13 @@ void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
if( aDimmed )
|
||||
color = color.Mix( bg, 0.5f );
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
GRPrintText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
|
||||
GetVertJustify(), penWidth, IsItalic(), IsBold(), GetDrawFont() );
|
||||
GetVertJustify(), penWidth, IsItalic(), IsBold(), font );
|
||||
}
|
||||
|
||||
|
||||
|
@ -328,6 +333,8 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
|
|||
if( GetText().IsEmpty() || aBackground )
|
||||
return;
|
||||
|
||||
RENDER_SETTINGS* renderSettings = aPlotter->RenderSettings();
|
||||
|
||||
// Calculate the text orientation, according to the symbol orientation/mirror.
|
||||
EDA_ANGLE orient = GetTextAngle();
|
||||
|
||||
|
@ -354,9 +361,9 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
|
|||
if( GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
else
|
||||
color = aPlotter->RenderSettings()->GetLayerColor( GetDefaultLayer() );
|
||||
color = renderSettings->GetLayerColor( GetDefaultLayer() );
|
||||
|
||||
bg = aPlotter->RenderSettings()->GetBackgroundColor();
|
||||
bg = renderSettings->GetBackgroundColor();
|
||||
|
||||
if( bg == COLOR4D::UNSPECIFIED )
|
||||
bg = COLOR4D::WHITE;
|
||||
|
@ -370,10 +377,14 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
|
|||
if( aDimmed )
|
||||
color = color.Mix( bg, 0.5f );
|
||||
|
||||
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||
int penWidth = GetEffectivePenWidth( renderSettings );
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( renderSettings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
|
||||
penWidth, IsItalic(), IsBold(), false, GetDrawFont() );
|
||||
penWidth, IsItalic(), IsBold(), false, font );
|
||||
}
|
||||
|
||||
|
||||
|
@ -528,7 +539,7 @@ void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
|
||||
aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
|
||||
aList.emplace_back( _( "Style" ), GetTextStyleName() );
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ public:
|
|||
|
||||
int GetPenWidth() const override;
|
||||
|
||||
KIFONT::FONT* GetDrawFont() const override;
|
||||
KIFONT::FONT* getDrawFont() const override;
|
||||
|
||||
/**
|
||||
* Copy parameters of this field to another field. Pointers are not copied.
|
||||
|
|
|
@ -172,12 +172,6 @@ int LIB_PIN::GetPenWidth() const
|
|||
}
|
||||
|
||||
|
||||
KIFONT::FONT* LIB_PIN::GetDrawFont() const
|
||||
{
|
||||
return KIFONT::FONT::GetFont( GetDefaultFont(), false, false );
|
||||
}
|
||||
|
||||
|
||||
wxString LIB_PIN::GetShownName() const
|
||||
{
|
||||
if( m_name == wxS( "~" ) )
|
||||
|
@ -380,7 +374,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
|
|||
|
||||
int x, y;
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
KIFONT::FONT* font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), false, false );
|
||||
|
||||
wxSize pinNameSize( m_nameTextSize, m_nameTextSize );
|
||||
wxSize pinNumSize( m_numTextSize, m_numTextSize );
|
||||
|
@ -573,10 +567,11 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECT
|
|||
if( aDimmed )
|
||||
color = color.Mix( bg, 0.5f );
|
||||
|
||||
VECTOR2I txtpos = aPosition;
|
||||
VECTOR2I txtpos = aPosition;
|
||||
int offset = schIUScale.mmToIU( 0.4 );
|
||||
GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_LEFT;
|
||||
EDA_ANGLE orient = ANGLE_HORIZONTAL;
|
||||
EDA_ANGLE orient = ANGLE_HORIZONTAL;
|
||||
KIFONT::FONT* font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), false, false );
|
||||
|
||||
switch( aOrientation )
|
||||
{
|
||||
|
@ -602,7 +597,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECT
|
|||
}
|
||||
|
||||
GRPrintText( DC, txtpos, color, typeName, orient, wxSize( textSize, textSize ), hjustify,
|
||||
GR_TEXT_V_ALIGN_CENTER, pensize, false, false, GetDrawFont() );
|
||||
GR_TEXT_V_ALIGN_CENTER, pensize, false, false, font );
|
||||
}
|
||||
|
||||
|
||||
|
@ -749,8 +744,10 @@ void LIB_PIN::PlotSymbol( PLOTTER *aPlotter, const VECTOR2I &aPosition, int aOri
|
|||
void LIB_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, int aPinOrient,
|
||||
int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed ) const
|
||||
{
|
||||
wxString name = GetShownName();
|
||||
wxString number = GetShownNumber();
|
||||
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
||||
KIFONT::FONT* font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), false, false );
|
||||
wxString name = GetShownName();
|
||||
wxString number = GetShownNumber();
|
||||
|
||||
if( name.IsEmpty() )
|
||||
aDrawPinName = false;
|
||||
|
@ -763,16 +760,16 @@ void LIB_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, int aPin
|
|||
|
||||
int x, y;
|
||||
int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, true ),
|
||||
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||
settings->GetDefaultPenWidth() );
|
||||
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, true ),
|
||||
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||
settings->GetDefaultPenWidth() );
|
||||
int name_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + namePenWidth;
|
||||
int num_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + numPenWidth;
|
||||
|
||||
/* Get the num and name colors */
|
||||
COLOR4D nameColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_PINNAM );
|
||||
COLOR4D numColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_PINNUM );
|
||||
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
|
||||
COLOR4D nameColor = settings->GetLayerColor( LAYER_PINNAM );
|
||||
COLOR4D numColor = settings->GetLayerColor( LAYER_PINNUM );
|
||||
COLOR4D bg = settings->GetBackgroundColor();
|
||||
|
||||
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
|
||||
bg = COLOR4D::WHITE;
|
||||
|
@ -800,7 +797,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, int aPin
|
|||
|
||||
{
|
||||
aPlotter->Text( VECTOR2I( px, py ), color, text, angle, VECTOR2I( size, size ),
|
||||
hJustify, vJustify, penWidth, false, false, false, GetDrawFont() );
|
||||
hJustify, vJustify, penWidth, false, false, false, font );
|
||||
};
|
||||
|
||||
/* Draw the text inside, but the pin numbers outside. */
|
||||
|
|
|
@ -202,8 +202,6 @@ public:
|
|||
|
||||
int GetPenWidth() const override;
|
||||
|
||||
KIFONT::FONT* GetDrawFont() const;
|
||||
|
||||
/**
|
||||
* Plot the pin number and pin text info, given the pin line coordinates.
|
||||
* Same as DrawPinTexts((), but output is the plotter
|
||||
|
|
|
@ -297,9 +297,14 @@ void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
|
|||
|
||||
int penWidth = std::max( GetEffectiveTextPenWidth(), settings->GetMinPenWidth() );
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
plotter->Text( pos, color, GetText(), t1 ? ANGLE_HORIZONTAL : ANGLE_VERTICAL, GetTextSize(),
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(),
|
||||
true, GetDrawFont() );
|
||||
true, font );
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,7 +314,7 @@ int LIB_TEXT::GetPenWidth() const
|
|||
}
|
||||
|
||||
|
||||
KIFONT::FONT* LIB_TEXT::GetDrawFont() const
|
||||
KIFONT::FONT* LIB_TEXT::getDrawFont() const
|
||||
{
|
||||
KIFONT::FONT* font = EDA_TEXT::GetFont();
|
||||
|
||||
|
@ -354,6 +359,11 @@ void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
|
|||
orient = ANGLE_HORIZONTAL;
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
/*
|
||||
* Calculate the text justification, according to the symbol orientation/mirror.
|
||||
* This is a bit complicated due to cumulative calculations:
|
||||
|
@ -374,7 +384,7 @@ void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
|
|||
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
|
||||
|
||||
GRPrintText( DC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(), GetDrawFont() );
|
||||
GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(), font );
|
||||
}
|
||||
|
||||
|
||||
|
@ -387,7 +397,7 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
|
|||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
|
||||
aList.emplace_back( _( "Style" ), GetTextStyleName() );
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
|
||||
int GetPenWidth() const override;
|
||||
|
||||
KIFONT::FONT* GetDrawFont() const override;
|
||||
KIFONT::FONT* getDrawFont() const override;
|
||||
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ int LIB_TEXTBOX::compare( const LIB_ITEM& aOther, int aCompareFlags ) const
|
|||
}
|
||||
|
||||
|
||||
KIFONT::FONT* LIB_TEXTBOX::GetDrawFont() const
|
||||
KIFONT::FONT* LIB_TEXTBOX::getDrawFont() const
|
||||
{
|
||||
KIFONT::FONT* font = EDA_TEXT::GetFont();
|
||||
|
||||
|
@ -305,13 +305,18 @@ void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
|
|||
: ANGLE_HORIZONTAL );
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
// NB: GetDrawPos() will want Symbol Editor (upside-down) coordinates
|
||||
text.SetStart( VECTOR2I( pt1.x, -pt1.y ) );
|
||||
text.SetEnd( VECTOR2I( pt2.x, -pt2.y ) );
|
||||
|
||||
GRPrintText( DC, text.GetDrawPos(), color, text.GetShownText(), text.GetTextAngle(),
|
||||
text.GetTextSize(), text.GetHorizJustify(), text.GetVertJustify(), penWidth,
|
||||
text.IsItalic(), text.IsBold(), text.GetDrawFont() );
|
||||
text.IsItalic(), text.IsBold(), font );
|
||||
}
|
||||
|
||||
|
||||
|
@ -319,10 +324,13 @@ wxString LIB_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
{
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
KIFONT::FONT* font = GetFont();
|
||||
VECTOR2D size = GetEnd() - GetStart();
|
||||
int colWidth = GetTextAngle() == ANGLE_HORIZONTAL ? size.x : size.y;
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
colWidth = abs( colWidth ) - GetTextMargin() * 2;
|
||||
font->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(), IsItalic() );
|
||||
|
||||
|
@ -382,21 +390,22 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf
|
|||
return;
|
||||
}
|
||||
|
||||
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
|
||||
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
|
||||
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
|
||||
RENDER_SETTINGS* renderSettings = aPlotter->RenderSettings();
|
||||
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
|
||||
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
|
||||
COLOR4D bg = renderSettings->GetBackgroundColor();
|
||||
|
||||
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
|
||||
bg = COLOR4D::WHITE;
|
||||
|
||||
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||
int penWidth = GetEffectivePenWidth( renderSettings );
|
||||
COLOR4D color = GetStroke().GetColor();
|
||||
PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
|
||||
|
||||
if( penWidth > 0 )
|
||||
{
|
||||
if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
|
||||
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
color = renderSettings->GetLayerColor( LAYER_DEVICE );
|
||||
|
||||
if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
|
||||
lineStyle = PLOT_DASH_TYPE::DASH;
|
||||
|
@ -410,12 +419,17 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf
|
|||
aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( renderSettings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
LIB_TEXTBOX text( *this );
|
||||
|
||||
color = GetTextColor();
|
||||
|
||||
if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
|
||||
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
color = renderSettings->GetLayerColor( LAYER_DEVICE );
|
||||
|
||||
if( aDimmed )
|
||||
color = color.Mix( bg, 0.5f );
|
||||
|
@ -443,7 +457,7 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf
|
|||
{
|
||||
aPlotter->Text( positions[ii], color, strings_list.Item( ii ), text.GetTextAngle(),
|
||||
text.GetTextSize(), text.GetHorizJustify(), text.GetVertJustify(),
|
||||
penWidth, text.IsItalic(), text.IsBold(), false, GetDrawFont() );
|
||||
penWidth, text.IsItalic(), text.IsBold(), false, font );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,7 +467,7 @@ void LIB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
|
|||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Text Box" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
|
||||
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
|
||||
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
||||
|
|
|
@ -57,8 +57,6 @@ public:
|
|||
|
||||
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override;
|
||||
|
||||
KIFONT::FONT* GetDrawFont() const override;
|
||||
|
||||
void MirrorHorizontally( const VECTOR2I& center );
|
||||
void MirrorVertically( const VECTOR2I& center );
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
@ -95,6 +93,9 @@ public:
|
|||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
protected:
|
||||
KIFONT::FONT* getDrawFont() const override;
|
||||
|
||||
private:
|
||||
int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
|
||||
|
||||
|
|
|
@ -1607,6 +1607,7 @@ void SCH_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
|
|||
|
||||
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
|
||||
GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
|
||||
GetRenderSettings()->SetDefaultFont( cfg->m_Appearance.default_font );
|
||||
|
||||
KIGFX::VIEW* view = GetCanvas()->GetView();
|
||||
view->SetLayerVisible( LAYER_ERC_ERR, cfg->m_Appearance.show_erc_errors );
|
||||
|
|
|
@ -266,7 +266,7 @@ int SCH_FIELD::GetPenWidth() const
|
|||
}
|
||||
|
||||
|
||||
KIFONT::FONT* SCH_FIELD::GetDrawFont() const
|
||||
KIFONT::FONT* SCH_FIELD::getDrawFont() const
|
||||
{
|
||||
KIFONT::FONT* font = EDA_TEXT::GetFont();
|
||||
|
||||
|
@ -295,14 +295,20 @@ std::vector<std::unique_ptr<KIFONT::GLYPH>>*
|
|||
SCH_FIELD::GetRenderCache( const wxString& forResolvedText, const VECTOR2I& forPosition,
|
||||
TEXT_ATTRIBUTES& aAttrs ) const
|
||||
{
|
||||
if( GetDrawFont()->IsOutline() )
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
if( font->IsOutline() )
|
||||
{
|
||||
KIFONT::OUTLINE_FONT* outlineFont = static_cast<KIFONT::OUTLINE_FONT*>( font );
|
||||
|
||||
if( m_renderCache.empty() || !m_renderCacheValid )
|
||||
{
|
||||
m_renderCache.clear();
|
||||
|
||||
KIFONT::OUTLINE_FONT* font = static_cast<KIFONT::OUTLINE_FONT*>( GetDrawFont() );
|
||||
font->GetLinesAsGlyphs( &m_renderCache, forResolvedText, forPosition, aAttrs );
|
||||
outlineFont->GetLinesAsGlyphs( &m_renderCache, forResolvedText, forPosition, aAttrs );
|
||||
|
||||
m_renderCachePos = forPosition;
|
||||
m_renderCacheValid = true;
|
||||
|
@ -366,6 +372,11 @@ void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
color = color.Mix( bg, 0.5f );
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
/*
|
||||
* Calculate the text justification, according to the symbol orientation/mirror.
|
||||
* This is a bit complicated due to cumulative calculations:
|
||||
|
@ -379,7 +390,7 @@ void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
textpos = GetBoundingBox().Centre() + aOffset;
|
||||
|
||||
GRPrintText( DC, textpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(), GetDrawFont() );
|
||||
GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(), font );
|
||||
}
|
||||
|
||||
|
||||
|
@ -754,7 +765,7 @@ void SCH_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
|
||||
aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
|
||||
aList.emplace_back( _( "Style" ), GetTextStyleName() );
|
||||
|
||||
|
@ -1015,8 +1026,13 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
textpos = GetBoundingBox().Centre();
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
|
||||
penWidth, IsItalic(), IsBold(), false, GetDrawFont() );
|
||||
penWidth, IsItalic(), IsBold(), false, font );
|
||||
|
||||
if( IsHypertext() )
|
||||
{
|
||||
|
|
|
@ -170,8 +170,6 @@ public:
|
|||
|
||||
int GetPenWidth() const override;
|
||||
|
||||
KIFONT::FONT* GetDrawFont() const override;
|
||||
|
||||
void ClearCaches() override;
|
||||
void ClearRenderCache() override;
|
||||
|
||||
|
@ -241,6 +239,9 @@ public:
|
|||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
KIFONT::FONT* getDrawFont() const override;
|
||||
|
||||
private:
|
||||
int m_id; ///< Field index, @see enum MANDATORY_FIELD_T
|
||||
|
||||
|
|
|
@ -861,7 +861,7 @@ void SCH_LABEL_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
|||
if( Type() == SCH_GLOBAL_LABEL_T || Type() == SCH_HIER_LABEL_T || Type() == SCH_SHEET_PIN_T )
|
||||
aList.emplace_back( _( "Type" ), getElectricalTypeLabel( GetShape() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
|
||||
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
|
||||
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
||||
|
@ -914,6 +914,11 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||
aPlotter->SetCurrentLineWidth( penWidth );
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
VECTOR2I textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
|
||||
CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
|
||||
|
||||
|
@ -925,7 +930,7 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
{
|
||||
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
|
||||
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold(),
|
||||
false, GetDrawFont() );
|
||||
false, font );
|
||||
|
||||
if( s_poly.size() )
|
||||
aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
|
||||
|
|
|
@ -1947,9 +1947,17 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
|
|||
attrs.m_Underlined = true;
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = aText->GetFont();
|
||||
|
||||
if( !font )
|
||||
{
|
||||
font = KIFONT::FONT::GetFont( m_schSettings.GetDefaultFont(), aText->IsBold(),
|
||||
aText->IsItalic() );
|
||||
}
|
||||
|
||||
// Adjust text drawn in an outline font to more closely mimic the positioning of
|
||||
// SCH_FIELD text.
|
||||
if( aText->GetDrawFont()->IsOutline() )
|
||||
if( font->IsOutline() )
|
||||
{
|
||||
BOX2I firstLineBBox = aText->GetTextBox( 0 );
|
||||
int sizeDiff = firstLineBBox.GetHeight() - aText->GetTextSize().y;
|
||||
|
@ -1971,8 +1979,8 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
|
|||
{
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
||||
|
||||
if( !aText->IsHypertext() )
|
||||
cache = aText->GetRenderCache( shownText, text_offset );
|
||||
if( !aText->IsHypertext() && font->IsOutline() )
|
||||
cache = aText->GetRenderCache( font, shownText, text_offset );
|
||||
|
||||
if( cache )
|
||||
{
|
||||
|
@ -1996,6 +2004,14 @@ void SCH_PAINTER::draw( const SCH_TEXTBOX* aTextBox, int aLayer )
|
|||
COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows );
|
||||
float borderWidth = getLineWidth( aTextBox, drawingShadows );
|
||||
|
||||
KIFONT::FONT* font = aTextBox->GetFont();
|
||||
|
||||
if( !font )
|
||||
{
|
||||
font = KIFONT::FONT::GetFont( m_schSettings.GetDefaultFont(), aTextBox->IsBold(),
|
||||
aTextBox->IsItalic() );
|
||||
}
|
||||
|
||||
auto drawText =
|
||||
[&]()
|
||||
{
|
||||
|
@ -2014,8 +2030,8 @@ void SCH_PAINTER::draw( const SCH_TEXTBOX* aTextBox, int aLayer )
|
|||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
||||
|
||||
if( !aTextBox->IsHypertext() )
|
||||
cache = aTextBox->GetRenderCache( shownText );
|
||||
if( !aTextBox->IsHypertext() && font->IsOutline() )
|
||||
cache = aTextBox->GetRenderCache( font, shownText );
|
||||
|
||||
if( cache )
|
||||
{
|
||||
|
|
|
@ -276,7 +276,7 @@ int SCH_TEXT::GetPenWidth() const
|
|||
}
|
||||
|
||||
|
||||
KIFONT::FONT* SCH_TEXT::GetDrawFont() const
|
||||
KIFONT::FONT* SCH_TEXT::getDrawFont() const
|
||||
{
|
||||
KIFONT::FONT* font = EDA_TEXT::GetFont();
|
||||
|
||||
|
@ -296,9 +296,14 @@ void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
|
||||
color = aSettings->GetLayerColor( m_layer );
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
// Adjust text drawn in an outline font to more closely mimic the positioning of
|
||||
// SCH_FIELD text.
|
||||
if( GetDrawFont()->IsOutline() )
|
||||
if( font->IsOutline() )
|
||||
{
|
||||
BOX2I firstLineBBox = GetTextBox( 0 );
|
||||
int sizeDiff = firstLineBBox.GetHeight() - GetTextSize().y;
|
||||
|
@ -443,7 +448,6 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
|
||||
COLOR4D color = GetTextColor();
|
||||
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
VECTOR2I text_offset = GetSchematicTextOffset( aPlotter->RenderSettings() );
|
||||
|
||||
if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
|
||||
|
@ -452,9 +456,14 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||
aPlotter->SetCurrentLineWidth( penWidth );
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
// Adjust text drawn in an outline font to more closely mimic the positioning of
|
||||
// SCH_FIELD text.
|
||||
if( GetDrawFont()->IsOutline() )
|
||||
if( font->IsOutline() )
|
||||
{
|
||||
BOX2I firstLineBBox = GetTextBox( 0 );
|
||||
int sizeDiff = firstLineBBox.GetHeight() - GetTextSize().y;
|
||||
|
@ -492,7 +501,7 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
|
|||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Graphic Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
|
||||
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
|
||||
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
||||
|
|
|
@ -170,8 +170,6 @@ public:
|
|||
|
||||
int GetPenWidth() const override;
|
||||
|
||||
KIFONT::FONT* GetDrawFont() const override;
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override
|
||||
{
|
||||
EDA_TEXT::Offset( aMoveVector );
|
||||
|
@ -223,6 +221,9 @@ public:
|
|||
|
||||
static HTML_MESSAGE_BOX* ShowSyntaxHelp( wxWindow* aParentWindow );
|
||||
|
||||
protected:
|
||||
KIFONT::FONT* getDrawFont() const override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The orientation of text and any associated drawing elements of derived objects.
|
||||
|
|
|
@ -213,7 +213,7 @@ bool SCH_TEXTBOX::operator<( const SCH_ITEM& aItem ) const
|
|||
}
|
||||
|
||||
|
||||
KIFONT::FONT* SCH_TEXTBOX::GetDrawFont() const
|
||||
KIFONT::FONT* SCH_TEXTBOX::getDrawFont() const
|
||||
{
|
||||
KIFONT::FONT* font = EDA_TEXT::GetFont();
|
||||
|
||||
|
@ -319,9 +319,13 @@ wxString SCH_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
text = ExpandTextVars( text, &textResolver, &schematicTextResolver, project );
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
VECTOR2D size = GetEnd() - GetStart();
|
||||
int colWidth = GetTextAngle() == ANGLE_HORIZONTAL ? size.x : size.y;
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
VECTOR2D size = GetEnd() - GetStart();
|
||||
int colWidth = GetTextAngle() == ANGLE_HORIZONTAL ? size.x : size.y;
|
||||
|
||||
colWidth = abs( colWidth ) - GetTextMargin() * 2;
|
||||
font->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(), IsItalic() );
|
||||
|
@ -384,7 +388,6 @@ void SCH_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
}
|
||||
|
||||
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
int penWidth = GetPenWidth();
|
||||
COLOR4D color = GetStroke().GetColor();
|
||||
PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
|
||||
|
@ -405,6 +408,11 @@ void SCH_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
color = GetTextColor();
|
||||
|
||||
if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
|
||||
|
@ -438,7 +446,7 @@ void SCH_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
|
|||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Text Box" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
|
||||
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
|
||||
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
||||
|
|
|
@ -70,8 +70,6 @@ public:
|
|||
|
||||
bool operator<( const SCH_ITEM& aItem ) const override;
|
||||
|
||||
KIFONT::FONT* GetDrawFont() const override;
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override
|
||||
{
|
||||
EDA_SHAPE::move( aMoveVector );
|
||||
|
@ -112,6 +110,9 @@ public:
|
|||
}
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
protected:
|
||||
KIFONT::FONT* getDrawFont() const override;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -576,12 +576,16 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
|
|||
GRForceBlackPen( false );
|
||||
dc.SetUserScale( scale, scale );
|
||||
|
||||
GetRenderSettings()->SetPrintDC( &dc );
|
||||
// Init the color of the layer actually used to print the drawing sheet:
|
||||
GetRenderSettings()->SetLayerColor( LAYER_DRAWINGSHEET,
|
||||
GetRenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) );
|
||||
KIGFX::SCH_RENDER_SETTINGS* cfg = GetRenderSettings();
|
||||
|
||||
PrintPage( GetRenderSettings() );
|
||||
cfg->SetPrintDC( &dc );
|
||||
|
||||
// Init the color of the layer actually used to print the drawing sheet:
|
||||
cfg->SetLayerColor( LAYER_DRAWINGSHEET, cfg->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) );
|
||||
|
||||
cfg->SetDefaultFont( eeconfig()->m_Appearance.default_font );
|
||||
|
||||
PrintPage( cfg );
|
||||
|
||||
{
|
||||
wxLogNull doNotLog; // disable logging of failed clipboard actions
|
||||
|
|
|
@ -292,6 +292,7 @@ void SYMBOL_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
SCH_BASE_FRAME::LoadSettings( GetSettings() );
|
||||
|
||||
GetRenderSettings()->m_ShowPinsElectricalType = m_settings->m_ShowPinElectricalType;
|
||||
GetRenderSettings()->SetDefaultFont( wxEmptyString );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -307,7 +307,6 @@ public:
|
|||
*/
|
||||
virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
|
||||
|
||||
virtual KIFONT::FONT* GetDrawFont() const;
|
||||
virtual EDA_ANGLE GetDrawRotation() const { return GetTextAngle(); }
|
||||
virtual VECTOR2I GetDrawPos() const { return GetTextPos(); }
|
||||
|
||||
|
@ -315,7 +314,8 @@ public:
|
|||
virtual void ClearBoundingBoxCache();
|
||||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>*
|
||||
GetRenderCache( const wxString& forResolvedText, const VECTOR2I& aOffset = { 0, 0 } ) const;
|
||||
GetRenderCache( const KIFONT::FONT* aFont, const wxString& forResolvedText,
|
||||
const VECTOR2I& aOffset = { 0, 0 } ) const;
|
||||
|
||||
// Support for reading the cache from disk.
|
||||
void SetupRenderCache( const wxString& aResolvedText, const EDA_ANGLE& aAngle );
|
||||
|
@ -355,12 +355,8 @@ public:
|
|||
static wxString GotoPageHref( const wxString& aDestination );
|
||||
|
||||
protected:
|
||||
/**
|
||||
* A hyperlink URL. If empty, this text object is not a hyperlink.
|
||||
*/
|
||||
wxString m_hyperlink;
|
||||
virtual KIFONT::FONT* getDrawFont() const;
|
||||
|
||||
private:
|
||||
void cacheShownText();
|
||||
|
||||
/**
|
||||
|
@ -376,6 +372,13 @@ private:
|
|||
const COLOR4D& aColor, OUTLINE_MODE aFillMode, const wxString& aText,
|
||||
const VECTOR2I& aPos );
|
||||
|
||||
protected:
|
||||
/**
|
||||
* A hyperlink URL. If empty, this text object is not a hyperlink.
|
||||
*/
|
||||
wxString m_hyperlink;
|
||||
|
||||
private:
|
||||
wxString m_text;
|
||||
wxString m_shown_text; // Cache of unescaped text for efficient access
|
||||
bool m_shown_text_has_text_var_refs;
|
||||
|
|
|
@ -291,6 +291,9 @@ public:
|
|||
void SetHighlightFactor( float aFactor ) { m_highlightFactor = aFactor; }
|
||||
void SetSelectFactor( float aFactor ) { m_selectFactor = aFactor; }
|
||||
|
||||
void SetDefaultFont( const wxString& aFont ) { m_defaultFont = aFont; }
|
||||
const wxString& GetDefaultFont() const { return m_defaultFont; }
|
||||
|
||||
// TODO: these can go away once the drawing sheet is moved to Cairo-based printing
|
||||
wxDC* GetPrintDC() const { return m_printDC; }
|
||||
void SetPrintDC( wxDC* aDC ) { m_printDC = aDC; }
|
||||
|
@ -335,6 +338,8 @@ protected:
|
|||
double m_dashLengthRatio;
|
||||
double m_gapLengthRatio;
|
||||
|
||||
wxString m_defaultFont;
|
||||
|
||||
bool m_isPrinting;
|
||||
LSET m_printLayers;
|
||||
|
||||
|
|
|
@ -144,14 +144,17 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run()
|
|||
if( constraint.GetSeverity() == RPT_SEVERITY_IGNORE )
|
||||
return true;
|
||||
|
||||
KIFONT::FONT* font = text->GetDrawFont();
|
||||
KIFONT::FONT* font = text->GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( wxEmptyString, text->IsBold(), text->IsItalic() );
|
||||
|
||||
if( font->IsOutline() )
|
||||
{
|
||||
if( !constraint.Value().HasMin() )
|
||||
return true;
|
||||
|
||||
auto* glyphs = text->GetRenderCache( text->GetShownText() );
|
||||
auto* glyphs = text->GetRenderCache( font, text->GetShownText() );
|
||||
bool collapsedStroke = false;
|
||||
bool collapsedArea = false;
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
|
|||
msg.Printf( wxT( "%g" ), GetTextAngle().AsDegrees() );
|
||||
aList.emplace_back( _( "Angle" ), msg );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
aList.emplace_back( _( "Thickness" ), aFrame->MessageTextFromValue( GetTextThickness() ) );
|
||||
aList.emplace_back( _( "Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
|
||||
aList.emplace_back( _( "Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
|
||||
|
@ -454,7 +454,7 @@ void FP_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLay
|
|||
int aError, ERROR_LOC aErrorLoc ) const
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
KIFONT::FONT* font = getDrawFont();
|
||||
int penWidth = GetEffectiveTextPenWidth();
|
||||
|
||||
// Note: this function is mainly used in 3D viewer.
|
||||
|
|
|
@ -309,7 +309,7 @@ void FP_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
|||
aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
|
||||
aList.emplace_back( _( "Angle" ), wxString::Format( "%g", GetTextAngle().AsDegrees() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
aList.emplace_back( _( "Thickness" ), aFrame->MessageTextFromValue( GetTextThickness() ) );
|
||||
aList.emplace_back( _( "Text Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
|
||||
aList.emplace_back( _( "Text Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
|
||||
|
@ -418,7 +418,7 @@ wxString FP_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
text = ExpandTextVars( text, &footprintResolver, &boardTextResolver, project );
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
KIFONT::FONT* font = getDrawFont();
|
||||
std::vector<VECTOR2I> corners = GetAnchorAndOppositeCorner();
|
||||
int colWidth = ( corners[1] - corners[0] ).EuclideanNorm();
|
||||
|
||||
|
@ -444,7 +444,7 @@ void FP_TEXTBOX::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID a
|
|||
int aClearance, int aError, ERROR_LOC aErrorLoc ) const
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
KIFONT::FONT* font = getDrawFont();
|
||||
int penWidth = GetEffectiveTextPenWidth();
|
||||
|
||||
// Note: this function is mainly used in 3D viewer.
|
||||
|
|
|
@ -869,11 +869,9 @@ void PCB_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
aCfg->m_Window.zoom_factors = { ZOOM_LIST_PCBNEW };
|
||||
}
|
||||
|
||||
// Some, but not all derived classes have a PCBNEW_SETTINGS.
|
||||
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
|
||||
|
||||
if( cfg )
|
||||
m_polarCoords = cfg->m_PolarCoords;
|
||||
// Some, but not all, derived classes have a PCBNEW_SETTINGS.
|
||||
if( PCBNEW_SETTINGS* pcbnew_cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg ) )
|
||||
m_polarCoords = pcbnew_cfg->m_PolarCoords;
|
||||
|
||||
wxASSERT( GetCanvas() );
|
||||
|
||||
|
@ -885,6 +883,7 @@ void PCB_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
{
|
||||
rs->SetHighlightFactor( aCfg->m_Graphics.highlight_factor );
|
||||
rs->SetSelectFactor( aCfg->m_Graphics.select_factor );
|
||||
rs->SetDefaultFont( wxEmptyString ); // Always the KiCad font for PCBs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
|
|||
|
||||
aList.emplace_back( _( "Units" ), EDA_UNIT_UTILS::GetLabel( GetUnits() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), m_text.GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), m_text.GetFont() ? m_text.GetFont()->GetName() : _( "Default" ) );
|
||||
aList.emplace_back( _( "Text Thickness" ),
|
||||
unitsProvider.MessageTextFromValue( m_text.GetTextThickness() ) );
|
||||
aList.emplace_back( _( "Text Width" ),
|
||||
|
|
|
@ -1855,6 +1855,14 @@ void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
|
|||
const COLOR4D& color = m_pcbSettings.GetColor( aText, aText->GetLayer() );
|
||||
bool outline_mode = !viewer_settings()->m_ViewersDisplay.m_DisplayTextFill;
|
||||
|
||||
KIFONT::FONT* font = aText->GetFont();
|
||||
|
||||
if( !font )
|
||||
{
|
||||
font = KIFONT::FONT::GetFont( m_pcbSettings.GetDefaultFont(), aText->IsBold(),
|
||||
aText->IsItalic() );
|
||||
}
|
||||
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetFillColor( color );
|
||||
|
||||
|
@ -1870,8 +1878,6 @@ void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
|
|||
knockouts.AddOutline( aPoly );
|
||||
} );
|
||||
|
||||
KIFONT::FONT* font = aText->GetDrawFont();
|
||||
|
||||
attrs.m_StrokeWidth = getLineThickness( aText->GetEffectiveTextPenWidth() );
|
||||
|
||||
callback_gal.SetIsFill( font->IsOutline() );
|
||||
|
@ -1904,16 +1910,15 @@ void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
|
|||
attrs.m_Halign = static_cast<GR_TEXT_H_ALIGN_T>( -attrs.m_Halign );
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = aText->GetRenderCache( resolvedText );
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
||||
|
||||
if( font->IsOutline() )
|
||||
cache = aText->GetRenderCache( font, resolvedText );
|
||||
|
||||
if( cache )
|
||||
{
|
||||
m_gal->DrawGlyphs( *cache );
|
||||
}
|
||||
else
|
||||
{
|
||||
strokeText( resolvedText, aText->GetTextPos(), attrs );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1925,6 +1930,14 @@ void PCB_PAINTER::draw( const PCB_TEXTBOX* aTextBox, int aLayer )
|
|||
PLOT_DASH_TYPE lineStyle = aTextBox->GetStroke().GetPlotStyle();
|
||||
wxString resolvedText( aTextBox->GetShownText() );
|
||||
|
||||
KIFONT::FONT* font = aTextBox->GetFont();
|
||||
|
||||
if( !font )
|
||||
{
|
||||
font = KIFONT::FONT::GetFont( m_pcbSettings.GetDefaultFont(), aTextBox->IsBold(),
|
||||
aTextBox->IsItalic() );
|
||||
}
|
||||
|
||||
if( aLayer == LAYER_LOCKED_ITEM_SHADOW ) // happens only if locked
|
||||
{
|
||||
const COLOR4D sh_color = m_pcbSettings.GetColor( aTextBox, aLayer );
|
||||
|
@ -1987,8 +2000,6 @@ void PCB_PAINTER::draw( const PCB_TEXTBOX* aTextBox, int aLayer )
|
|||
attrs.m_Halign = static_cast<GR_TEXT_H_ALIGN_T>( -attrs.m_Halign );
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = aTextBox->GetRenderCache( resolvedText );
|
||||
|
||||
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
||||
{
|
||||
const COLOR4D sh_color = m_pcbSettings.GetColor( aTextBox, aLayer );
|
||||
|
@ -1997,14 +2008,15 @@ void PCB_PAINTER::draw( const PCB_TEXTBOX* aTextBox, int aLayer )
|
|||
attrs.m_StrokeWidth += m_lockedShadowMargin;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
||||
|
||||
if( font->IsOutline() )
|
||||
cache = aTextBox->GetRenderCache( font, resolvedText );
|
||||
|
||||
if( cache )
|
||||
{
|
||||
m_gal->DrawGlyphs( *cache );
|
||||
}
|
||||
else
|
||||
{
|
||||
strokeText( resolvedText, aTextBox->GetDrawPos(), attrs );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2019,6 +2031,14 @@ void PCB_PAINTER::draw( const FP_TEXT* aText, int aLayer )
|
|||
bool outline_mode = !viewer_settings()->m_ViewersDisplay.m_DisplayTextFill;
|
||||
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
|
||||
|
||||
KIFONT::FONT* font = aText->GetFont();
|
||||
|
||||
if( !font )
|
||||
{
|
||||
font = KIFONT::FONT::GetFont( m_pcbSettings.GetDefaultFont(), aText->IsBold(),
|
||||
aText->IsItalic() );
|
||||
}
|
||||
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetFillColor( color );
|
||||
attrs.m_Angle = aText->GetDrawRotation();
|
||||
|
@ -2035,8 +2055,6 @@ void PCB_PAINTER::draw( const FP_TEXT* aText, int aLayer )
|
|||
knockouts.AddOutline( aPoly );
|
||||
} );
|
||||
|
||||
KIFONT::FONT* font = aText->GetDrawFont();
|
||||
|
||||
attrs.m_StrokeWidth = getLineThickness( aText->GetEffectiveTextPenWidth() );
|
||||
|
||||
callback_gal.SetIsFill( font->IsOutline() );
|
||||
|
@ -2069,16 +2087,15 @@ void PCB_PAINTER::draw( const FP_TEXT* aText, int aLayer )
|
|||
attrs.m_Halign = static_cast<GR_TEXT_H_ALIGN_T>( -attrs.m_Halign );
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = aText->GetRenderCache( resolvedText );
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
||||
|
||||
if( font->IsOutline() )
|
||||
cache = aText->GetRenderCache( font, resolvedText );
|
||||
|
||||
if( cache )
|
||||
{
|
||||
m_gal->DrawGlyphs( *cache );
|
||||
}
|
||||
else
|
||||
{
|
||||
strokeText( resolvedText, aText->GetTextPos(), attrs );
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the umbilical line
|
||||
|
@ -2144,16 +2161,15 @@ void PCB_PAINTER::draw( const FP_TEXTBOX* aTextBox, int aLayer )
|
|||
attrs.m_Halign = static_cast<GR_TEXT_H_ALIGN_T>( -attrs.m_Halign );
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = aTextBox->GetRenderCache( resolvedText );
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
||||
|
||||
if( aTextBox->GetFont() && aTextBox->GetFont()->IsOutline() )
|
||||
cache = aTextBox->GetRenderCache( aTextBox->GetFont(), resolvedText );
|
||||
|
||||
if( cache )
|
||||
{
|
||||
m_gal->DrawGlyphs( *cache );
|
||||
}
|
||||
else
|
||||
{
|
||||
strokeText( resolvedText, aTextBox->GetDrawPos(), attrs );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2438,7 +2454,10 @@ void PCB_PAINTER::draw( const PCB_DIMENSION_BASE* aDimension, int aLayer )
|
|||
else
|
||||
attrs.m_StrokeWidth = getLineThickness( text.GetEffectiveTextPenWidth() );
|
||||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = text.GetRenderCache( resolvedText );
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
||||
|
||||
if( text.GetFont() && text.GetFont()->IsOutline() )
|
||||
cache = text.GetRenderCache( text.GetFont(), resolvedText );
|
||||
|
||||
if( cache )
|
||||
{
|
||||
|
|
|
@ -139,7 +139,7 @@ void PCB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
|
|||
|
||||
aList.emplace_back( _( "Angle" ), wxString::Format( wxT( "%g" ), GetTextAngle().AsDegrees() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
aList.emplace_back( _( "Thickness" ), aFrame->MessageTextFromValue( GetTextThickness() ) );
|
||||
aList.emplace_back( _( "Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
|
||||
aList.emplace_back( _( "Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
|
||||
|
@ -288,7 +288,7 @@ void PCB_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLa
|
|||
int aClearance, int aError, ERROR_LOC aErrorLoc ) const
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
KIFONT::FONT* font = getDrawFont();
|
||||
int penWidth = GetEffectiveTextPenWidth();
|
||||
|
||||
// Note: this function is mainly used in 3D viewer.
|
||||
|
|
|
@ -282,7 +282,7 @@ wxString PCB_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
if( board && HasTextVars() && aDepth < 10 )
|
||||
text = ExpandTextVars( text, &pcbTextResolver, &boardTextResolver, board->GetProject() );
|
||||
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
KIFONT::FONT* font = getDrawFont();
|
||||
std::vector<VECTOR2I> corners = GetAnchorAndOppositeCorner();
|
||||
int colWidth = ( corners[1] - corners[0] ).EuclideanNorm();
|
||||
|
||||
|
@ -305,7 +305,7 @@ void PCB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
|
|||
aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
|
||||
aList.emplace_back( _( "Angle" ), wxString::Format( "%g", GetTextAngle().AsDegrees() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
aList.emplace_back( _( "Text Thickness" ), aFrame->MessageTextFromValue( GetTextThickness() ) );
|
||||
aList.emplace_back( _( "Text Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
|
||||
aList.emplace_back( _( "Text Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
|
||||
|
@ -451,7 +451,7 @@ void PCB_TEXTBOX::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID
|
|||
int aClearance, int aError, ERROR_LOC aErrorLoc ) const
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
KIFONT::FONT* font = getDrawFont();
|
||||
int penWidth = GetEffectiveTextPenWidth();
|
||||
|
||||
// Note: this function is mainly used in 3D viewer.
|
||||
|
|
|
@ -402,9 +402,16 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aText, const COLOR4
|
|||
m_plotter->SetColor( color );
|
||||
|
||||
// calculate some text parameters :
|
||||
VECTOR2I size = aText->GetTextSize();
|
||||
VECTOR2I pos = aText->GetTextPos();
|
||||
int thickness = aText->GetEffectiveTextPenWidth();
|
||||
VECTOR2I size = aText->GetTextSize();
|
||||
VECTOR2I pos = aText->GetTextPos();
|
||||
int thickness = aText->GetEffectiveTextPenWidth();
|
||||
KIFONT::FONT* font = aText->GetFont();
|
||||
|
||||
if( !font )
|
||||
{
|
||||
font = KIFONT::FONT::GetFont( m_plotter->RenderSettings()->GetDefaultFont(),
|
||||
aText->IsBold(), aText->IsItalic() );
|
||||
}
|
||||
|
||||
if( aText->IsMirrored() )
|
||||
size.x = -size.x; // Text is mirrored
|
||||
|
@ -428,7 +435,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aText, const COLOR4
|
|||
|
||||
m_plotter->Text( pos, aColor, aText->GetShownText(), aText->GetDrawRotation(), size,
|
||||
aText->GetHorizJustify(), aText->GetVertJustify(), thickness,
|
||||
aText->IsItalic(), allow_bold, false, aText->GetDrawFont(), &gbr_metadata );
|
||||
aText->IsItalic(), allow_bold, false, font, &gbr_metadata );
|
||||
}
|
||||
|
||||
|
||||
|
@ -779,8 +786,15 @@ void BRDITEMS_PLOTTER::PlotFootprintShape( const FP_SHAPE* aShape )
|
|||
|
||||
void BRDITEMS_PLOTTER::PlotPcbText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, bool aIsKnockout )
|
||||
{
|
||||
KIFONT::FONT* font = aText->GetFont();
|
||||
|
||||
if( !font )
|
||||
{
|
||||
font = KIFONT::FONT::GetFont( m_plotter->RenderSettings()->GetDefaultFont(),
|
||||
aText->IsBold(), aText->IsItalic() );
|
||||
}
|
||||
|
||||
wxString shownText( aText->GetShownText() );
|
||||
KIFONT::FONT* font = aText->GetDrawFont();
|
||||
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
|
||||
|
||||
if( shownText.IsEmpty() )
|
||||
|
|
|
@ -547,7 +547,8 @@ void PCB_PLUGIN::formatPolyPts( const SHAPE_LINE_CHAIN& outline, int aNestLevel,
|
|||
void PCB_PLUGIN::formatRenderCache( const EDA_TEXT* aText, int aNestLevel ) const
|
||||
{
|
||||
const wxString& shownText = aText->GetShownText();
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = aText->GetRenderCache( shownText );
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = aText->GetRenderCache( aText->GetFont(),
|
||||
shownText );
|
||||
|
||||
m_out->Print( aNestLevel, "(render_cache %s %s\n",
|
||||
m_out->Quotew( shownText ).c_str(),
|
||||
|
|
Loading…
Reference in New Issue