Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/StelPainter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ struct StringTexture

StringTexture* StelPainter::getTextTexture(const QString& str, int pixelSize) const
{
QByteArray hash = str.toUtf8() + QByteArray::number(pixelSize);
QByteArray hash = str.toUtf8() + QByteArray::number(pixelSize) + currentFont.key().toUtf8();
StringTexture* cachedTex = texCache.object(hash);
if (cachedTex)
return cachedTex;
Expand Down
1 change: 0 additions & 1 deletion src/core/modules/Asterism.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

#include <vector>
#include <QString>
#include <QFont>

class StarMgr;
class StelPainter;
Expand Down
17 changes: 9 additions & 8 deletions src/core/modules/AsterismMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <QString>
#include <QStringList>
#include <QDir>
#include <QFont>

// constructor which loads all data from appropriate files
AsterismMgr::AsterismMgr(StarMgr *_hip_stars)
Expand All @@ -51,6 +52,7 @@ AsterismMgr::AsterismMgr(StarMgr *_hip_stars)
, linesFadeDuration(1.f)
, namesFadeDuration(1.f)
, rayHelpersFadeDuration(1.f)
, fontSize(14)
, asterismLineThickness(1)
, rayHelperThickness(1)
{
Expand Down Expand Up @@ -244,17 +246,14 @@ Vec3f AsterismMgr::getLabelsColor() const

void AsterismMgr::setFontSize(const int newFontSize)
{
if ((asterFont.pixelSize() - newFontSize) != 0)
{
asterFont.setPixelSize(newFontSize);
StelApp::immediateSave("viewing/asterism_font_size", newFontSize);
emit fontSizeChanged(newFontSize);
}
fontSize=newFontSize;
StelApp::immediateSave("viewing/asterism_font_size", newFontSize);
emit fontSizeChanged(newFontSize);
}

int AsterismMgr::getFontSize() const
{
return asterFont.pixelSize();
return fontSize;
}

void AsterismMgr::setAsterismLineThickness(const int thickness)
Expand Down Expand Up @@ -287,7 +286,9 @@ void AsterismMgr::draw(StelCore* core)
{
const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000);
StelPainter sPainter(prj);
sPainter.setFont(asterFont);
QFont font=QGuiApplication::font();
font.setPixelSize(fontSize);
sPainter.setFont(font);
drawLines(sPainter, core);
drawRayHelpers(sPainter, core);
Vec3d vel(0.);
Expand Down
3 changes: 1 addition & 2 deletions src/core/modules/AsterismMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <vector>
#include <QString>
#include <QStringList>
#include <QFont>

class StelToneReproducer;
class StarMgr;
Expand Down Expand Up @@ -265,7 +264,6 @@ private slots:

std::vector<Asterism*> asterisms;
std::vector<Asterism*> selected; // More than one can be selected at a time
QFont asterFont;
StarMgr* hipStarMgr;

QString currentSkyCultureID;
Expand All @@ -280,6 +278,7 @@ private slots:
float namesFadeDuration;
float rayHelpersFadeDuration;

int fontSize;
// Store the thickness of lines of the asterisms
int asterismLineThickness;
int rayHelperThickness;
Expand Down
1 change: 0 additions & 1 deletion src/core/modules/Constellation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <vector>
#include <QJsonObject>
#include <QString>
#include <QFont>

class StarMgr;
class StelPainter;
Expand Down
18 changes: 10 additions & 8 deletions src/core/modules/ConstellationMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include <QString>
#include <QStringList>
#include <QDir>
#include <QFont>

// constructor which loads all data from appropriate files
ConstellationMgr::ConstellationMgr(StarMgr *_hip_stars)
Expand All @@ -68,6 +69,7 @@ ConstellationMgr::ConstellationMgr(StarMgr *_hip_stars)
zodiacFadeDuration(1.),
lunarSystemFadeDuration(1.),
checkLoadingData(false),
fontSize(15),
constellationLineThickness(1),
boundariesThickness(1),
hullsThickness(1),
Expand Down Expand Up @@ -465,17 +467,14 @@ Vec3f ConstellationMgr::getLabelsColor() const

void ConstellationMgr::setFontSize(const int newFontSize)
{
if (asterFont.pixelSize() - newFontSize != 0)
{
asterFont.setPixelSize(newFontSize);
StelApp::immediateSave("viewing/constellation_font_size", newFontSize);
emit fontSizeChanged(newFontSize);
}
fontSize=newFontSize;
StelApp::immediateSave("viewing/constellation_font_size", newFontSize);
emit fontSizeChanged(newFontSize);
}

int ConstellationMgr::getFontSize() const
{
return asterFont.pixelSize();
return fontSize;
}

void ConstellationMgr::setConstellationLineThickness(const int thickness)
Expand Down Expand Up @@ -692,7 +691,10 @@ void ConstellationMgr::draw(StelCore* core)
{
const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000);
StelPainter sPainter(prj);
sPainter.setFont(asterFont);
//sPainter.setFont(asterFont);
QFont font=QGuiApplication::font();
font.setPixelSize(fontSize);
sPainter.setFont(font);
drawLines(sPainter, core);
Vec3d vel(0.);
if (core->getUseAberration())
Expand Down
3 changes: 1 addition & 2 deletions src/core/modules/ConstellationMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <vector>
#include <QString>
#include <QStringList>
#include <QFont>

class StelToneReproducer;
class StarMgr;
Expand Down Expand Up @@ -523,7 +522,6 @@ private slots:
private:
Constellation* findFromAbbreviation(const QString& abbreviation) const;
QList<Constellation*> constellations; //!< Constellations in the current SkyCulture
QFont asterFont;
StarMgr* hipStarMgr;

bool isolateSelected; //!< true to pick individual constellations.
Expand All @@ -549,6 +547,7 @@ private slots:

bool checkLoadingData;

int fontSize;
int constellationLineThickness; //!< line width of the constellation lines
int boundariesThickness; //!< line width of the constellation boundaries
int hullsThickness; //!< line width of the constellation boundaries
Expand Down
9 changes: 7 additions & 2 deletions src/core/modules/StarMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include <QDebug>
#include <QFileInfo>
#include <QDir>
#include <QFont>
#include <QCryptographicHash>

#include <cstdlib>
Expand Down Expand Up @@ -164,6 +165,7 @@ StarMgr::StarMgr(void)
, maxGeodesicGridLevel(-1)
, lastMaxSearchLevel(-1)
, hipIndex(new HipIndexStruct[NR_OF_HIP+1])
, fontSize(12)
{
setObjectName("StarMgr");
objectMgr = GETSTELMODULE(StelObjectMgr);
Expand Down Expand Up @@ -1282,7 +1284,10 @@ void StarMgr::draw(StelCore* core)

// Prepare openGL for drawing many stars
StelPainter sPainter(prj);
sPainter.setFont(starFont);
QFont font=QGuiApplication::font();
font.setPixelSize(fontSize);
sPainter.setFont(font);

skyDrawer->preDrawPointSource(&sPainter);

// Prepare a table for storing precomputed RCMag for all ZoneArrays
Expand Down Expand Up @@ -2108,7 +2113,7 @@ void StarMgr::setLabelsAmount(double a)
// Define font file name and size to use for star names display
void StarMgr::setFontSize(int newFontSize)
{
starFont.setPixelSize(newFontSize);
fontSize=newFontSize;
}

// Set flag for usage designations of stars for their labels instead common names.
Expand Down
3 changes: 1 addition & 2 deletions src/core/modules/StarMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#ifndef STARMGR_HPP
#define STARMGR_HPP

#include <QFont>
#include <QVariantMap>
#include <QVector>
#include "StelFader.hpp"
Expand Down Expand Up @@ -638,7 +637,7 @@ private slots:

static QHash<StarId, binaryorbitstar> binaryOrbitStarMap;

QFont starFont;
int fontSize;
static bool flagSciNames;
static bool flagAdditionalStarNames;
static bool flagDesignations;
Expand Down
Loading