externals: Place font data within cpp files

This places the font data within cpp files, which mitigates the
possibility of the font data being duplicated within the binary if it's
referred to in more than one translation unit in the future. It also
stores the data within a std::array, which is more flexible when it
comes to operating with the standard library.

Furthermore, it makes the data arrays const. This is what we want, as it
allows the compiler to store the data within the read-only segment. As
it is, having several large sections of mutable data like this just
leaves spots in memory that we can accidentally write to (via accidental
overruns, what have you) and actually have it work. This ensures the
font data remains the same no matter what.
This commit is contained in:
Lioncash 2018-09-11 04:15:36 -04:00
parent 3bac3051fc
commit 46ba1bc40f
20 changed files with 111727 additions and 111667 deletions

View file

@ -1,3 +1,16 @@
add_library(open_source_archives INTERFACE) add_library(open_source_archives
src/FontChineseSimplified.cpp
src/FontChineseTraditional.cpp
src/FontExtendedChineseSimplified.cpp
src/FontKorean.cpp
src/FontNintendoExtended.cpp
src/FontStandard.cpp
include/FontChineseSimplified.h
include/FontChineseTraditional.h
include/FontExtendedChineseSimplified.h
include/FontKorean.h
include/FontNintendoExtended.h
include/FontStandard.h
)
target_include_directories(open_source_archives INTERFACE "include/") target_include_directories(open_source_archives PUBLIC include)

View file

@ -0,0 +1,6 @@
#pragma once
#include <array>
extern const std::array<unsigned char, 217276> FontChineseSimplified;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
#pragma once
#include <array>
extern const std::array<unsigned char, 222236> FontChineseTraditional;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
#pragma once
#include <array>
extern const std::array<unsigned char, 293516> FontExtendedChineseSimplified;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
#pragma once
#include <array>
extern const std::array<unsigned char, 217276> FontKorean;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
#pragma once
#include <array>
extern const std::array<unsigned char, 172064> FontNintendoExtended;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
#pragma once
#include <array>
extern const std::array<unsigned char, 217276> FontStandard;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -2,12 +2,12 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <FontChineseSimplified.ttf.h> #include <FontChineseSimplified.h>
#include <FontChineseTraditional.ttf.h> #include <FontChineseTraditional.h>
#include <FontExtendedChineseSimplified.ttf.h> #include <FontExtendedChineseSimplified.h>
#include <FontKorean.ttf.h> #include <FontKorean.h>
#include <FontNintendoExtended.ttf.h> #include <FontNintendoExtended.h>
#include <FontStandard.ttf.h> #include <FontStandard.h>
#include "common/common_paths.h" #include "common/common_paths.h"
#include "common/file_util.h" #include "common/file_util.h"