mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:37:34 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -147,7 +147,7 @@ ErrorOr<NonnullRefPtr<BitmapFont>> BitmapFont::masked_character_set() const
|
|||
return adopt_nonnull_ref_or_enomem(new (nothrow) BitmapFont(m_name, m_family, new_rows, new_widths, m_fixed_width, m_glyph_width, m_glyph_height, m_glyph_spacing, new_range_mask_size, new_range_mask, m_baseline, m_mean_line, m_presentation_size, m_weight, m_slope, true));
|
||||
}
|
||||
|
||||
BitmapFont::BitmapFont(String name, String family, u8* rows, u8* widths, bool is_fixed_width, u8 glyph_width, u8 glyph_height, u8 glyph_spacing, u16 range_mask_size, u8* range_mask, u8 baseline, u8 mean_line, u8 presentation_size, u16 weight, u8 slope, bool owns_arrays)
|
||||
BitmapFont::BitmapFont(DeprecatedString name, DeprecatedString family, u8* rows, u8* widths, bool is_fixed_width, u8 glyph_width, u8 glyph_height, u8 glyph_spacing, u16 range_mask_size, u8* range_mask, u8 baseline, u8 mean_line, u8 presentation_size, u16 weight, u8 slope, bool owns_arrays)
|
||||
: m_name(move(name))
|
||||
, m_family(move(family))
|
||||
, m_range_mask_size(range_mask_size)
|
||||
|
@ -222,15 +222,15 @@ ErrorOr<NonnullRefPtr<BitmapFont>> BitmapFont::load_from_memory(u8 const* data)
|
|||
glyph_count += 256 * popcount(range_mask[i]);
|
||||
u8* rows = range_mask + header.range_mask_size;
|
||||
u8* widths = (u8*)(rows) + glyph_count * bytes_per_glyph;
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) BitmapFont(String(header.name), String(header.family), rows, widths, !header.is_variable_width, header.glyph_width, header.glyph_height, header.glyph_spacing, header.range_mask_size, range_mask, header.baseline, header.mean_line, header.presentation_size, header.weight, header.slope));
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) BitmapFont(DeprecatedString(header.name), DeprecatedString(header.family), rows, widths, !header.is_variable_width, header.glyph_width, header.glyph_height, header.glyph_spacing, header.range_mask_size, range_mask, header.baseline, header.mean_line, header.presentation_size, header.weight, header.slope));
|
||||
}
|
||||
|
||||
RefPtr<BitmapFont> BitmapFont::load_from_file(String const& path)
|
||||
RefPtr<BitmapFont> BitmapFont::load_from_file(DeprecatedString const& path)
|
||||
{
|
||||
return MUST(try_load_from_file(move(path)));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<BitmapFont>> BitmapFont::try_load_from_file(String const& path)
|
||||
ErrorOr<NonnullRefPtr<BitmapFont>> BitmapFont::try_load_from_file(DeprecatedString const& path)
|
||||
{
|
||||
auto file = TRY(Core::MappedFile::map(path));
|
||||
auto font = TRY(load_from_memory((u8 const*)file->data()));
|
||||
|
@ -238,7 +238,7 @@ ErrorOr<NonnullRefPtr<BitmapFont>> BitmapFont::try_load_from_file(String const&
|
|||
return font;
|
||||
}
|
||||
|
||||
ErrorOr<void> BitmapFont::write_to_file(String const& path)
|
||||
ErrorOr<void> BitmapFont::write_to_file(DeprecatedString const& path)
|
||||
{
|
||||
FontFileHeader header;
|
||||
memset(&header, 0, sizeof(FontFileHeader));
|
||||
|
@ -364,12 +364,12 @@ ALWAYS_INLINE int BitmapFont::unicode_view_width(T const& view) const
|
|||
return longest_width;
|
||||
}
|
||||
|
||||
String BitmapFont::qualified_name() const
|
||||
DeprecatedString BitmapFont::qualified_name() const
|
||||
{
|
||||
return String::formatted("{} {} {} {}", family(), presentation_size(), weight(), slope());
|
||||
return DeprecatedString::formatted("{} {} {} {}", family(), presentation_size(), weight(), slope());
|
||||
}
|
||||
|
||||
String BitmapFont::variant() const
|
||||
DeprecatedString BitmapFont::variant() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append(weight_to_name(weight()));
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
|
@ -30,9 +30,9 @@ public:
|
|||
ErrorOr<NonnullRefPtr<BitmapFont>> masked_character_set() const;
|
||||
ErrorOr<NonnullRefPtr<BitmapFont>> unmasked_character_set() const;
|
||||
|
||||
static RefPtr<BitmapFont> load_from_file(String const& path);
|
||||
static ErrorOr<NonnullRefPtr<BitmapFont>> try_load_from_file(String const& path);
|
||||
ErrorOr<void> write_to_file(String const& path);
|
||||
static RefPtr<BitmapFont> load_from_file(DeprecatedString const& path);
|
||||
static ErrorOr<NonnullRefPtr<BitmapFont>> try_load_from_file(DeprecatedString const& path);
|
||||
ErrorOr<void> write_to_file(DeprecatedString const& path);
|
||||
|
||||
~BitmapFont();
|
||||
|
||||
|
@ -92,8 +92,8 @@ public:
|
|||
int width(Utf8View const&) const override;
|
||||
int width(Utf32View const&) const override;
|
||||
|
||||
String name() const override { return m_name; }
|
||||
void set_name(String name) { m_name = move(name); }
|
||||
DeprecatedString name() const override { return m_name; }
|
||||
void set_name(DeprecatedString name) { m_name = move(name); }
|
||||
|
||||
bool is_fixed_width() const override { return m_fixed_width; }
|
||||
void set_fixed_width(bool b) { m_fixed_width = b; }
|
||||
|
@ -113,15 +113,15 @@ public:
|
|||
u16 range_size() const { return m_range_mask_size; }
|
||||
bool is_range_empty(u32 code_point) const { return !(m_range_mask[code_point / 256 / 8] & 1 << (code_point / 256 % 8)); }
|
||||
|
||||
String family() const override { return m_family; }
|
||||
void set_family(String family) { m_family = move(family); }
|
||||
String variant() const override;
|
||||
DeprecatedString family() const override { return m_family; }
|
||||
void set_family(DeprecatedString family) { m_family = move(family); }
|
||||
DeprecatedString variant() const override;
|
||||
|
||||
String qualified_name() const override;
|
||||
String human_readable_name() const override { return String::formatted("{} {} {}", family(), variant(), presentation_size()); }
|
||||
DeprecatedString qualified_name() const override;
|
||||
DeprecatedString human_readable_name() const override { return DeprecatedString::formatted("{} {} {}", family(), variant(), presentation_size()); }
|
||||
|
||||
private:
|
||||
BitmapFont(String name, String family, u8* rows, u8* widths, bool is_fixed_width,
|
||||
BitmapFont(DeprecatedString name, DeprecatedString family, u8* rows, u8* widths, bool is_fixed_width,
|
||||
u8 glyph_width, u8 glyph_height, u8 glyph_spacing, u16 range_mask_size, u8* range_mask,
|
||||
u8 baseline, u8 mean_line, u8 presentation_size, u16 weight, u8 slope, bool owns_arrays = false);
|
||||
|
||||
|
@ -133,8 +133,8 @@ private:
|
|||
void update_x_height() { m_x_height = m_baseline - m_mean_line; };
|
||||
int glyph_or_emoji_width_for_variable_width_font(u32 code_point) const;
|
||||
|
||||
String m_name;
|
||||
String m_family;
|
||||
DeprecatedString m_name;
|
||||
DeprecatedString m_family;
|
||||
size_t m_glyph_count { 0 };
|
||||
|
||||
u16 m_range_mask_size { 0 };
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/Span.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font/Emoji.h>
|
||||
|
@ -18,7 +18,7 @@ namespace Gfx {
|
|||
// https://unicode.org/emoji/charts/emoji-list.html
|
||||
// https://unicode.org/emoji/charts/emoji-zwj-sequences.html
|
||||
|
||||
static HashMap<String, RefPtr<Gfx::Bitmap>> s_emojis;
|
||||
static HashMap<DeprecatedString, RefPtr<Gfx::Bitmap>> s_emojis;
|
||||
|
||||
Bitmap const* Emoji::emoji_for_code_point(u32 code_point)
|
||||
{
|
||||
|
@ -28,13 +28,13 @@ Bitmap const* Emoji::emoji_for_code_point(u32 code_point)
|
|||
Bitmap const* Emoji::emoji_for_code_points(Span<u32 const> const& code_points)
|
||||
{
|
||||
// FIXME: This function is definitely not fast.
|
||||
auto basename = String::join('_', code_points, "U+{:X}"sv);
|
||||
auto basename = DeprecatedString::join('_', code_points, "U+{:X}"sv);
|
||||
|
||||
auto it = s_emojis.find(basename);
|
||||
if (it != s_emojis.end())
|
||||
return (*it).value.ptr();
|
||||
|
||||
auto bitmap_or_error = Bitmap::try_load_from_file(String::formatted("/res/emoji/{}.png", basename));
|
||||
auto bitmap_or_error = Bitmap::try_load_from_file(DeprecatedString::formatted("/res/emoji/{}.png", basename));
|
||||
if (bitmap_or_error.is_error()) {
|
||||
s_emojis.set(basename, nullptr);
|
||||
return nullptr;
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
#include <AK/Bitmap.h>
|
||||
#include <AK/ByteReader.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
virtual int width(Utf8View const&) const = 0;
|
||||
virtual int width(Utf32View const&) const = 0;
|
||||
|
||||
virtual String name() const = 0;
|
||||
virtual DeprecatedString name() const = 0;
|
||||
|
||||
virtual bool is_fixed_width() const = 0;
|
||||
|
||||
|
@ -152,11 +152,11 @@ public:
|
|||
|
||||
virtual size_t glyph_count() const = 0;
|
||||
|
||||
virtual String family() const = 0;
|
||||
virtual String variant() const = 0;
|
||||
virtual DeprecatedString family() const = 0;
|
||||
virtual DeprecatedString variant() const = 0;
|
||||
|
||||
virtual String qualified_name() const = 0;
|
||||
virtual String human_readable_name() const = 0;
|
||||
virtual DeprecatedString qualified_name() const = 0;
|
||||
virtual DeprecatedString human_readable_name() const = 0;
|
||||
|
||||
Font const& bold_variant() const;
|
||||
|
||||
|
|
|
@ -26,17 +26,17 @@ FontDatabase& FontDatabase::the()
|
|||
}
|
||||
|
||||
static RefPtr<Font> s_default_font;
|
||||
static String s_default_font_query;
|
||||
static DeprecatedString s_default_font_query;
|
||||
|
||||
static RefPtr<Font> s_window_title_font;
|
||||
static String s_window_title_font_query;
|
||||
static DeprecatedString s_window_title_font_query;
|
||||
|
||||
static RefPtr<Font> s_fixed_width_font;
|
||||
static String s_fixed_width_font_query;
|
||||
static DeprecatedString s_fixed_width_font_query;
|
||||
|
||||
static String s_default_fonts_lookup_path = "/res/fonts";
|
||||
static DeprecatedString s_default_fonts_lookup_path = "/res/fonts";
|
||||
|
||||
void FontDatabase::set_default_font_query(String query)
|
||||
void FontDatabase::set_default_font_query(DeprecatedString query)
|
||||
{
|
||||
if (s_default_font_query == query)
|
||||
return;
|
||||
|
@ -44,12 +44,12 @@ void FontDatabase::set_default_font_query(String query)
|
|||
s_default_font = nullptr;
|
||||
}
|
||||
|
||||
String FontDatabase::default_font_query()
|
||||
DeprecatedString FontDatabase::default_font_query()
|
||||
{
|
||||
return s_default_font_query;
|
||||
}
|
||||
|
||||
void FontDatabase::set_window_title_font_query(String query)
|
||||
void FontDatabase::set_window_title_font_query(DeprecatedString query)
|
||||
{
|
||||
if (s_window_title_font_query == query)
|
||||
return;
|
||||
|
@ -57,19 +57,19 @@ void FontDatabase::set_window_title_font_query(String query)
|
|||
s_window_title_font = nullptr;
|
||||
}
|
||||
|
||||
String FontDatabase::window_title_font_query()
|
||||
DeprecatedString FontDatabase::window_title_font_query()
|
||||
{
|
||||
return s_window_title_font_query;
|
||||
}
|
||||
|
||||
void FontDatabase::set_default_fonts_lookup_path(String path)
|
||||
void FontDatabase::set_default_fonts_lookup_path(DeprecatedString path)
|
||||
{
|
||||
if (s_default_fonts_lookup_path == path)
|
||||
return;
|
||||
s_default_fonts_lookup_path = move(path);
|
||||
}
|
||||
|
||||
String FontDatabase::default_fonts_lookup_path()
|
||||
DeprecatedString FontDatabase::default_fonts_lookup_path()
|
||||
{
|
||||
return s_default_fonts_lookup_path;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ Font& FontDatabase::window_title_font()
|
|||
return *s_window_title_font;
|
||||
}
|
||||
|
||||
void FontDatabase::set_fixed_width_font_query(String query)
|
||||
void FontDatabase::set_fixed_width_font_query(DeprecatedString query)
|
||||
{
|
||||
if (s_fixed_width_font_query == query)
|
||||
return;
|
||||
|
@ -102,7 +102,7 @@ void FontDatabase::set_fixed_width_font_query(String query)
|
|||
s_fixed_width_font = nullptr;
|
||||
}
|
||||
|
||||
String FontDatabase::fixed_width_font_query()
|
||||
DeprecatedString FontDatabase::fixed_width_font_query()
|
||||
{
|
||||
return s_fixed_width_font_query;
|
||||
}
|
||||
|
@ -118,13 +118,13 @@ Font& FontDatabase::default_fixed_width_font()
|
|||
}
|
||||
|
||||
struct FontDatabase::Private {
|
||||
HashMap<String, NonnullRefPtr<Gfx::Font>> full_name_to_font_map;
|
||||
HashMap<DeprecatedString, NonnullRefPtr<Gfx::Font>> full_name_to_font_map;
|
||||
HashMap<FlyString, Vector<NonnullRefPtr<Typeface>>> typefaces;
|
||||
};
|
||||
|
||||
void FontDatabase::load_all_fonts_from_path(String const& root)
|
||||
void FontDatabase::load_all_fonts_from_path(DeprecatedString const& root)
|
||||
{
|
||||
Queue<String> path_queue;
|
||||
Queue<DeprecatedString> path_queue;
|
||||
path_queue.enqueue(root);
|
||||
|
||||
while (!path_queue.is_empty()) {
|
||||
|
@ -206,7 +206,7 @@ RefPtr<Gfx::Font> FontDatabase::get_by_name(StringView name)
|
|||
auto slope = parts.take_last().to_int().value_or(0);
|
||||
auto weight = parts.take_last().to_int().value_or(0);
|
||||
auto size = parts.take_last().to_int().value_or(0);
|
||||
auto family = String::join(' ', parts);
|
||||
auto family = DeprecatedString::join(' ', parts);
|
||||
return get(family, size, weight, slope);
|
||||
}
|
||||
dbgln("Font lookup failed: '{}'", name);
|
||||
|
@ -239,7 +239,7 @@ RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, FlyString const& va
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<Typeface> FontDatabase::get_or_create_typeface(String const& family, String const& variant)
|
||||
RefPtr<Typeface> FontDatabase::get_or_create_typeface(DeprecatedString const& family, DeprecatedString const& variant)
|
||||
{
|
||||
auto it = m_private->typefaces.find(family);
|
||||
if (it != m_private->typefaces.end()) {
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibGfx/Font/Typeface.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
|
||||
|
@ -38,15 +38,15 @@ public:
|
|||
static Font& default_fixed_width_font();
|
||||
static Font& window_title_font();
|
||||
|
||||
static String default_font_query();
|
||||
static String window_title_font_query();
|
||||
static String fixed_width_font_query();
|
||||
static DeprecatedString default_font_query();
|
||||
static DeprecatedString window_title_font_query();
|
||||
static DeprecatedString fixed_width_font_query();
|
||||
|
||||
static String default_fonts_lookup_path();
|
||||
static void set_default_font_query(String);
|
||||
static void set_window_title_font_query(String);
|
||||
static void set_fixed_width_font_query(String);
|
||||
static void set_default_fonts_lookup_path(String);
|
||||
static DeprecatedString default_fonts_lookup_path();
|
||||
static void set_default_font_query(DeprecatedString);
|
||||
static void set_window_title_font_query(DeprecatedString);
|
||||
static void set_fixed_width_font_query(DeprecatedString);
|
||||
static void set_default_fonts_lookup_path(DeprecatedString);
|
||||
|
||||
RefPtr<Gfx::Font> get(FlyString const& family, float point_size, unsigned weight, unsigned slope, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No);
|
||||
RefPtr<Gfx::Font> get(FlyString const& family, FlyString const& variant, float point_size, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No);
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
void for_each_typeface(Function<void(Typeface const&)>);
|
||||
|
||||
void load_all_fonts_from_path(String const&);
|
||||
void load_all_fonts_from_path(DeprecatedString const&);
|
||||
|
||||
private:
|
||||
FontDatabase();
|
||||
|
@ -64,7 +64,7 @@ private:
|
|||
|
||||
void load_fonts();
|
||||
|
||||
RefPtr<Typeface> get_or_create_typeface(String const& family, String const& variant);
|
||||
RefPtr<Typeface> get_or_create_typeface(DeprecatedString const& family, DeprecatedString const& variant);
|
||||
|
||||
struct Private;
|
||||
OwnPtr<Private> m_private;
|
||||
|
|
|
@ -57,14 +57,14 @@ public:
|
|||
virtual int width(StringView) const override;
|
||||
virtual int width(Utf8View const&) const override;
|
||||
virtual int width(Utf32View const&) const override;
|
||||
virtual String name() const override { return String::formatted("{} {}", family(), variant()); }
|
||||
virtual DeprecatedString name() const override { return DeprecatedString::formatted("{} {}", family(), variant()); }
|
||||
virtual bool is_fixed_width() const override { return m_font->is_fixed_width(); }
|
||||
virtual u8 glyph_spacing() const override { return 0; }
|
||||
virtual size_t glyph_count() const override { return m_font->glyph_count(); }
|
||||
virtual String family() const override { return m_font->family(); }
|
||||
virtual String variant() const override { return m_font->variant(); }
|
||||
virtual String qualified_name() const override { return String::formatted("{} {} {} {}", family(), presentation_size(), weight(), slope()); }
|
||||
virtual String human_readable_name() const override { return String::formatted("{} {} {}", family(), variant(), presentation_size()); }
|
||||
virtual DeprecatedString family() const override { return m_font->family(); }
|
||||
virtual DeprecatedString variant() const override { return m_font->variant(); }
|
||||
virtual DeprecatedString qualified_name() const override { return DeprecatedString::formatted("{} {} {} {}", family(), presentation_size(), weight(), slope()); }
|
||||
virtual DeprecatedString human_readable_name() const override { return DeprecatedString::formatted("{} {} {}", family(), variant(), presentation_size()); }
|
||||
|
||||
private:
|
||||
NonnullRefPtr<VectorFont> m_font;
|
||||
|
|
|
@ -296,7 +296,7 @@ Optional<i16> Kern::read_glyph_kerning_format0(ReadonlyBytes slice, u16 left_gly
|
|||
return 0;
|
||||
}
|
||||
|
||||
String Name::string_for_id(NameId id) const
|
||||
DeprecatedString Name::string_for_id(NameId id) const
|
||||
{
|
||||
auto num_entries = be_u16(m_slice.offset_pointer(2));
|
||||
auto string_offset = be_u16(m_slice.offset_pointer(4));
|
||||
|
@ -310,7 +310,7 @@ String Name::string_for_id(NameId id) const
|
|||
}
|
||||
|
||||
if (valid_ids.is_empty())
|
||||
return String::empty();
|
||||
return DeprecatedString::empty();
|
||||
|
||||
auto it = valid_ids.find_if([this](auto const& i) {
|
||||
// check if font has naming table for en-US language id
|
||||
|
@ -330,7 +330,7 @@ String Name::string_for_id(NameId id) const
|
|||
return decoder.to_utf8(StringView { (char const*)m_slice.offset_pointer(string_offset + offset), length });
|
||||
}
|
||||
|
||||
return String((char const*)m_slice.offset_pointer(string_offset + offset), length);
|
||||
return DeprecatedString((char const*)m_slice.offset_pointer(string_offset + offset), length);
|
||||
}
|
||||
|
||||
GlyphHorizontalMetrics Hmtx::get_glyph_horizontal_metrics(u32 glyph_id) const
|
||||
|
@ -354,7 +354,7 @@ GlyphHorizontalMetrics Hmtx::get_glyph_horizontal_metrics(u32 glyph_id) const
|
|||
};
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_file(String path, unsigned index)
|
||||
ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_file(DeprecatedString path, unsigned index)
|
||||
{
|
||||
auto file = TRY(Core::MappedFile::map(path));
|
||||
auto font = TRY(try_load_from_externally_owned_memory(file->bytes(), index));
|
||||
|
@ -590,7 +590,7 @@ u16 Font::units_per_em() const
|
|||
return m_head.units_per_em();
|
||||
}
|
||||
|
||||
String Font::family() const
|
||||
DeprecatedString Font::family() const
|
||||
{
|
||||
auto string = m_name.typographic_family_name();
|
||||
if (!string.is_empty())
|
||||
|
@ -598,7 +598,7 @@ String Font::family() const
|
|||
return m_name.family_name();
|
||||
}
|
||||
|
||||
String Font::variant() const
|
||||
DeprecatedString Font::variant() const
|
||||
{
|
||||
auto string = m_name.typographic_subfamily_name();
|
||||
if (!string.is_empty())
|
||||
|
|
|
@ -22,7 +22,7 @@ class Font : public Gfx::VectorFont {
|
|||
AK_MAKE_NONCOPYABLE(Font);
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<Font>> try_load_from_file(String path, unsigned index = 0);
|
||||
static ErrorOr<NonnullRefPtr<Font>> try_load_from_file(DeprecatedString path, unsigned index = 0);
|
||||
static ErrorOr<NonnullRefPtr<Font>> try_load_from_externally_owned_memory(ReadonlyBytes bytes, unsigned index = 0);
|
||||
|
||||
virtual Gfx::ScaledFontMetrics metrics(float x_scale, float y_scale) const override;
|
||||
|
@ -32,8 +32,8 @@ public:
|
|||
virtual u32 glyph_count() const override;
|
||||
virtual u16 units_per_em() const override;
|
||||
virtual u32 glyph_id_for_code_point(u32 code_point) const override { return m_cmap.glyph_id_for_code_point(code_point); }
|
||||
virtual String family() const override;
|
||||
virtual String variant() const override;
|
||||
virtual DeprecatedString family() const override;
|
||||
virtual DeprecatedString variant() const override;
|
||||
virtual u16 weight() const override;
|
||||
virtual u8 slope() const override;
|
||||
virtual bool is_fixed_width() const override;
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Error.h>
|
||||
#include <AK/FixedArray.h>
|
||||
#include <AK/Span.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
namespace TTF {
|
||||
|
||||
|
@ -173,10 +173,10 @@ public:
|
|||
};
|
||||
static Optional<Name> from_slice(ReadonlyBytes);
|
||||
|
||||
String family_name() const { return string_for_id(NameId::FamilyName); }
|
||||
String subfamily_name() const { return string_for_id(NameId::SubfamilyName); }
|
||||
String typographic_family_name() const { return string_for_id(NameId::TypographicFamilyName); }
|
||||
String typographic_subfamily_name() const { return string_for_id(NameId::TypographicSubfamilyName); }
|
||||
DeprecatedString family_name() const { return string_for_id(NameId::FamilyName); }
|
||||
DeprecatedString subfamily_name() const { return string_for_id(NameId::SubfamilyName); }
|
||||
DeprecatedString typographic_family_name() const { return string_for_id(NameId::TypographicFamilyName); }
|
||||
DeprecatedString typographic_subfamily_name() const { return string_for_id(NameId::TypographicSubfamilyName); }
|
||||
|
||||
private:
|
||||
enum class NameId {
|
||||
|
@ -200,7 +200,7 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
String string_for_id(NameId id) const;
|
||||
DeprecatedString string_for_id(NameId id) const;
|
||||
|
||||
ReadonlyBytes m_slice;
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Gfx {
|
|||
|
||||
class Typeface : public RefCounted<Typeface> {
|
||||
public:
|
||||
Typeface(String const& family, String const& variant)
|
||||
Typeface(DeprecatedString const& family, DeprecatedString const& variant)
|
||||
: m_family(family)
|
||||
, m_variant(variant)
|
||||
{
|
||||
|
|
|
@ -40,8 +40,8 @@ public:
|
|||
virtual u32 glyph_count() const = 0;
|
||||
virtual u16 units_per_em() const = 0;
|
||||
virtual u32 glyph_id_for_code_point(u32 code_point) const = 0;
|
||||
virtual String family() const = 0;
|
||||
virtual String variant() const = 0;
|
||||
virtual DeprecatedString family() const = 0;
|
||||
virtual DeprecatedString variant() const = 0;
|
||||
virtual u16 weight() const = 0;
|
||||
virtual u8 slope() const = 0;
|
||||
virtual bool is_fixed_width() const = 0;
|
||||
|
|
|
@ -50,7 +50,7 @@ static u16 pow_2_less_than_or_equal(u16 x)
|
|||
return result;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_file(String path, unsigned int index)
|
||||
ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_file(DeprecatedString path, unsigned int index)
|
||||
{
|
||||
auto file = TRY(Core::MappedFile::map(path));
|
||||
return try_load_from_externally_owned_memory(file->bytes(), index);
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Noncopyable.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font/VectorFont.h>
|
||||
|
@ -20,7 +20,7 @@ class Font : public Gfx::VectorFont {
|
|||
AK_MAKE_NONCOPYABLE(Font);
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<Font>> try_load_from_file(String path, unsigned index = 0);
|
||||
static ErrorOr<NonnullRefPtr<Font>> try_load_from_file(DeprecatedString path, unsigned index = 0);
|
||||
static ErrorOr<NonnullRefPtr<Font>> try_load_from_externally_owned_memory(ReadonlyBytes bytes, unsigned index = 0);
|
||||
|
||||
virtual Gfx::ScaledFontMetrics metrics(float x_scale, float y_scale) const override { return m_input_font->metrics(x_scale, y_scale); }
|
||||
|
@ -30,8 +30,8 @@ public:
|
|||
virtual u32 glyph_count() const override { return m_input_font->glyph_count(); }
|
||||
virtual u16 units_per_em() const override { return m_input_font->units_per_em(); }
|
||||
virtual u32 glyph_id_for_code_point(u32 code_point) const override { return m_input_font->glyph_id_for_code_point(code_point); }
|
||||
virtual String family() const override { return m_input_font->family(); }
|
||||
virtual String variant() const override { return m_input_font->variant(); }
|
||||
virtual DeprecatedString family() const override { return m_input_font->family(); }
|
||||
virtual DeprecatedString variant() const override { return m_input_font->variant(); }
|
||||
virtual u16 weight() const override { return m_input_font->weight(); }
|
||||
virtual u8 slope() const override { return m_input_font->slope(); }
|
||||
virtual bool is_fixed_width() const override { return m_input_font->is_fixed_width(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue