First round of caf::FontTools

This commit is contained in:
Gaute Lindkvist
2020-05-09 11:23:58 +02:00
parent 0e70cf809c
commit 2fe4372dc2
86 changed files with 1021 additions and 966 deletions

View File

@@ -20,7 +20,9 @@
#include "RivGridBoxGenerator.h"
#include "RiaColorTools.h"
#include "RiaFontCache.h"
#include "RiaGuiApplication.h"
#include "RiaPreferences.h"
#include "RivPartPriority.h"
#include "RivPatchGenerator.h"
@@ -49,6 +51,8 @@ RivGridBoxGenerator::RivGridBoxGenerator()
m_scaleZ = 1.0;
m_displayModelOffset = cvf::Vec3d::ZERO;
m_fontPointSize = caf::FontTools::absolutePointSize(RiaPreferences::current()->defaultSceneFontSize());
}
//--------------------------------------------------------------------------------------------------
@@ -212,6 +216,18 @@ void RivGridBoxGenerator::createGridBoxParts()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivGridBoxGenerator::setGridLabelFontSize( int fontSize )
{
if (m_fontPointSize != fontSize)
{
m_fontPointSize = fontSize;
m_needsRegeneration = true;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -653,9 +669,12 @@ void RivGridBoxGenerator::createLegend( EdgeType edge, cvf::Collection<cvf::Part
cvf::ref<cvf::DrawableText> geo = new cvf::DrawableText;
cvf::Font* standardFont = RiaGuiApplication::instance()->defaultSceneFont();
geo->setFont( standardFont );
cvf::ref<cvf::Font> font = RiaGuiApplication::instance()->defaultSceneFont();
if (caf::FontTools::absolutePointSize(RiaPreferences::current()->defaultSceneFontSize()) != m_fontPointSize)
{
font = RiaFontCache::getFont(m_fontPointSize);
}
geo->setFont( font.p() );
geo->setTextColor( m_gridLegendColor );
geo->setCheckPosVisible( false );
geo->setDrawBackground( false );

View File

@@ -19,6 +19,8 @@
#pragma once
#include "RiaFontCache.h"
#include "cvfCollection.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
@@ -46,7 +48,7 @@ public:
void updateFromBackgroundColor( const cvf::Color3f& backgroundColor );
void createGridBoxParts();
void setGridLabelFontSize(int fontSize);
void updateFromCamera( const cvf::Camera* camera );
cvf::Model* model();
@@ -122,6 +124,7 @@ private:
cvf::Color3f m_gridColor;
cvf::Color3f m_gridLegendColor;
int m_fontPointSize;
bool m_needsRegeneration;
};

View File

@@ -179,7 +179,7 @@ void RivContourMapProjectionPartMgr::appendContourLinesToModel( const cvf::Camer
cvf::ref<cvf::DrawableText> RivContourMapProjectionPartMgr::createTextLabel( const cvf::Color3f& textColor,
const cvf::Color3f& backgroundColor )
{
auto font = RiaFontCache::getFont( RiaFontCache::FONT_SIZE_10 );
auto font = RiaFontCache::getFont( RiaFontCache::FontSize::FONT_SIZE_10 );
cvf::ref<cvf::DrawableText> labelDrawable = new cvf::DrawableText();
labelDrawable->setFont( font.p() );