mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 06:42:08 +00:00
cleaner constructor interface.
This commit is contained in:
parent
10ce3abb77
commit
a016bf1ef2
3 changed files with 4 additions and 4 deletions
|
@ -47,7 +47,7 @@ class CanvasFont
|
|||
public:
|
||||
CanvasFont(const std::string& fontname, double height, std::vector<uint8_t>& _data) : fontname(fontname), height(height)
|
||||
{
|
||||
ttf = std::make_unique<TrueTypeFont>(_data);
|
||||
ttf = std::make_unique<TrueTypeFont>(std::make_shared<TrueTypeFontFileData>(_data));
|
||||
textmetrics = ttf->GetTextMetrics(height);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <fstream>
|
||||
#endif
|
||||
|
||||
TrueTypeFont::TrueTypeFont(std::shared_ptr<TrueTypeFontFileData> initdata, int ttcFontIndex) : data(std::move(initdata))
|
||||
TrueTypeFont::TrueTypeFont(std::shared_ptr<TrueTypeFontFileData>& initdata, int ttcFontIndex) : data(initdata)
|
||||
{
|
||||
if (data->size() > 0x7fffffff)
|
||||
throw std::runtime_error("TTF file is larger than 2 gigabytes!");
|
||||
|
|
|
@ -445,7 +445,7 @@ public:
|
|||
class TrueTypeFontFileData
|
||||
{
|
||||
public:
|
||||
TrueTypeFontFileData(std::vector<uint8_t> data) : dataVector(std::move(data))
|
||||
TrueTypeFontFileData(std::vector<uint8_t>& data) : dataVector(std::move(data))
|
||||
{
|
||||
dataPtr = dataVector.data();
|
||||
dataSize = dataVector.size();
|
||||
|
@ -491,7 +491,7 @@ private:
|
|||
class TrueTypeFont
|
||||
{
|
||||
public:
|
||||
TrueTypeFont(std::shared_ptr<TrueTypeFontFileData> data, int ttcFontIndex = 0);
|
||||
TrueTypeFont(std::shared_ptr<TrueTypeFontFileData>& data, int ttcFontIndex = 0);
|
||||
|
||||
static std::vector<TTCFontName> GetFontNames(const std::shared_ptr<TrueTypeFontFileData>& data);
|
||||
|
||||
|
|
Loading…
Reference in a new issue