|
|
@@ -128,28 +128,28 @@ bool FontProvider::LoadFontFace(const String& file_name, bool fallback_face, Sty
|
|
|
file_interface->Read(buffer, length, handle);
|
|
|
file_interface->Close(handle);
|
|
|
|
|
|
- bool result = Get().LoadFontFace(buffer, (int)length, fallback_face, std::move(buffer_ptr), file_name, {}, Style::FontStyle::Normal, weight);
|
|
|
+ bool result = Get().LoadFontFace({buffer, length}, fallback_face, std::move(buffer_ptr), file_name, {}, Style::FontStyle::Normal, weight);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-bool FontProvider::LoadFontFace(const byte* data, int data_size, const String& font_family, Style::FontStyle style, Style::FontWeight weight,
|
|
|
+bool FontProvider::LoadFontFace(Span<const byte> data, const String& font_family, Style::FontStyle style, Style::FontWeight weight,
|
|
|
bool fallback_face)
|
|
|
{
|
|
|
const String source = "memory";
|
|
|
|
|
|
- bool result = Get().LoadFontFace(data, data_size, fallback_face, nullptr, source, font_family, style, weight);
|
|
|
+ bool result = Get().LoadFontFace(data, fallback_face, nullptr, source, font_family, style, weight);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-bool FontProvider::LoadFontFace(const byte* data, int data_size, bool fallback_face, UniquePtr<byte[]> face_memory, const String& source,
|
|
|
- String font_family, Style::FontStyle style, Style::FontWeight weight)
|
|
|
+bool FontProvider::LoadFontFace(Span<const byte> data, bool fallback_face, UniquePtr<byte[]> face_memory, const String& source, String font_family,
|
|
|
+ Style::FontStyle style, Style::FontWeight weight)
|
|
|
{
|
|
|
using Style::FontWeight;
|
|
|
|
|
|
Vector<FaceVariation> face_variations;
|
|
|
- if (!FreeType::GetFaceVariations(data, data_size, face_variations))
|
|
|
+ if (!FreeType::GetFaceVariations(data, face_variations))
|
|
|
{
|
|
|
Log::Message(Log::LT_ERROR, "Failed to load font face from '%s': Invalid or unsupported font face file format.", source.c_str());
|
|
|
return false;
|
|
|
@@ -205,7 +205,7 @@ bool FontProvider::LoadFontFace(const byte* data, int data_size, bool fallback_f
|
|
|
|
|
|
for (const FaceVariation& variation : load_variations)
|
|
|
{
|
|
|
- FontFaceHandleFreetype ft_face = FreeType::LoadFace(data, data_size, source, variation.named_instance_index);
|
|
|
+ FontFaceHandleFreetype ft_face = FreeType::LoadFace(data, source, variation.named_instance_index);
|
|
|
if (!ft_face)
|
|
|
return false;
|
|
|
|