1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:57:44 +00:00

LibGfx: Rename TTF/TrueType to OpenType

OpenType is the backwards-compatible successor to TrueType, and the
format we're actually parsing in LibGfx. So let's call it that.
This commit is contained in:
Andreas Kling 2022-12-19 12:26:27 +01:00
parent ed84a6f6ee
commit f982400063
15 changed files with 40 additions and 40 deletions

View file

@ -12,7 +12,7 @@
#include <LibCore/File.h>
#include <LibGfx/Font/Font.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/Font/TrueType/Font.h>
#include <LibGfx/Font/OpenType/Font.h>
#include <LibGfx/Font/Typeface.h>
#include <LibGfx/Font/WOFF/Font.h>
#include <stdlib.h>
@ -151,7 +151,7 @@ void FontDatabase::load_all_fonts_from_path(DeprecatedString const& root)
}
} else if (path.ends_with(".ttf"sv)) {
// FIXME: What about .otf
if (auto font_or_error = TTF::Font::try_load_from_file(path); !font_or_error.is_error()) {
if (auto font_or_error = OpenType::Font::try_load_from_file(path); !font_or_error.is_error()) {
auto font = font_or_error.release_value();
auto typeface = get_or_create_typeface(font->family(), font->variant());
typeface->set_vector_font(move(font));

View file

@ -5,9 +5,9 @@
*/
#include <AK/Optional.h>
#include <LibGfx/Font/TrueType/Cmap.h>
#include <LibGfx/Font/OpenType/Cmap.h>
namespace TTF {
namespace OpenType {
extern u16 be_u16(u8 const*);
extern u32 be_u32(u8 const*);

View file

@ -9,7 +9,7 @@
#include <AK/Span.h>
#include <stdint.h>
namespace TTF {
namespace OpenType {
class Cmap {
public:

View file

@ -9,15 +9,15 @@
#include <AK/Checked.h>
#include <AK/Try.h>
#include <LibCore/MappedFile.h>
#include <LibGfx/Font/TrueType/Cmap.h>
#include <LibGfx/Font/TrueType/Font.h>
#include <LibGfx/Font/TrueType/Glyf.h>
#include <LibGfx/Font/TrueType/Tables.h>
#include <LibGfx/Font/OpenType/Cmap.h>
#include <LibGfx/Font/OpenType/Font.h>
#include <LibGfx/Font/OpenType/Glyf.h>
#include <LibGfx/Font/OpenType/Tables.h>
#include <LibTextCodec/Decoder.h>
#include <math.h>
#include <sys/mman.h>
namespace TTF {
namespace OpenType {
u16 be_u16(u8 const*);
u32 be_u32(u8 const*);
@ -206,12 +206,12 @@ i16 Kern::get_glyph_kerning(u16 left_glyph_id, u16 right_glyph_id) const
auto coverage = be_u16(subtable_slice.offset(2 * sizeof(u16)));
if (version != 0) {
dbgln("TTF::Kern: unsupported subtable version {}", version);
dbgln("OpenType::Kern: unsupported subtable version {}", version);
continue;
}
if (subtable_slice.size() < length) {
dbgln("TTF::Kern: subtable has an invalid size {}", length);
dbgln("OpenType::Kern: subtable has an invalid size {}", length);
continue;
}
@ -224,7 +224,7 @@ i16 Kern::get_glyph_kerning(u16 left_glyph_id, u16 right_glyph_id) const
// FIXME: implement support for these features
if (!is_horizontal || is_minimum || is_cross_stream || (reserved_bits > 0)) {
dbgln("TTF::Kern: FIXME: implement missing feature support for subtable");
dbgln("OpenType::Kern: FIXME: implement missing feature support for subtable");
continue;
}
@ -235,7 +235,7 @@ i16 Kern::get_glyph_kerning(u16 left_glyph_id, u16 right_glyph_id) const
subtable_kerning = read_glyph_kerning_format0(subtable_slice.slice(Sizes::SubtableHeader), left_glyph_id, right_glyph_id);
break;
default:
dbgln("TTF::Kern: FIXME: subtable format {} is unsupported", format);
dbgln("OpenType::Kern: FIXME: subtable format {} is unsupported", format);
continue;
}
if (!subtable_kerning.has_value())

View file

@ -11,12 +11,12 @@
#include <AK/StringView.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/Font/Font.h>
#include <LibGfx/Font/TrueType/Cmap.h>
#include <LibGfx/Font/TrueType/Glyf.h>
#include <LibGfx/Font/TrueType/Tables.h>
#include <LibGfx/Font/OpenType/Cmap.h>
#include <LibGfx/Font/OpenType/Glyf.h>
#include <LibGfx/Font/OpenType/Tables.h>
#include <LibGfx/Font/VectorFont.h>
namespace TTF {
namespace OpenType {
class Font : public Gfx::VectorFont {
AK_MAKE_NONCOPYABLE(Font);

View file

@ -4,11 +4,11 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGfx/Font/TrueType/Glyf.h>
#include <LibGfx/Font/OpenType/Glyf.h>
#include <LibGfx/Path.h>
#include <LibGfx/Point.h>
namespace TTF {
namespace OpenType {
extern u16 be_u16(u8 const* ptr);
extern u32 be_u32(u8 const* ptr);

View file

@ -10,11 +10,11 @@
#include <AK/Vector.h>
#include <LibGfx/AffineTransform.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/Font/OpenType/Tables.h>
#include <LibGfx/Font/PathRasterizer.h>
#include <LibGfx/Font/TrueType/Tables.h>
#include <math.h>
namespace TTF {
namespace OpenType {
class Loca {
public:

View file

@ -12,7 +12,7 @@
#include <AK/FixedArray.h>
#include <AK/Span.h>
namespace TTF {
namespace OpenType {
enum class IndexToLocFormat {
Offset16,

View file

@ -7,7 +7,7 @@
#include <AK/ByteBuffer.h>
#include <AK/IntegralMath.h>
#include <LibCompress/Zlib.h>
#include <LibGfx/Font/TrueType/Font.h>
#include <LibGfx/Font/OpenType/Font.h>
#include <LibGfx/Font/WOFF/Font.h>
namespace WOFF {
@ -142,7 +142,7 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_externally_owned_memory(Readonl
font_buffer_offset += orig_length;
}
auto input_font = TRY(TTF::Font::try_load_from_externally_owned_memory(font_buffer.bytes(), index));
auto input_font = TRY(OpenType::Font::try_load_from_externally_owned_memory(font_buffer.bytes(), index));
auto font = adopt_ref(*new Font(input_font, move(font_buffer)));
return font;
}