From 215d50a087109241bd88e65c8fd3e55d86a8ec3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 6 Mar 2019 13:30:43 +0100 Subject: [PATCH] Text: allow empty files in AbstractFont. In particular, MagnumFont can be an empty. --- doc/changelog.dox | 6 ++++++ src/Magnum/Text/AbstractFont.cpp | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index e9d7676d8..8e269f238 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -122,6 +122,12 @@ See also: experience for example when using ANGLE on Windows. See @ref Platform-Sdl2Application-usage-gles for more information. +@subsubsection changelog-latest-changes-text Text library + +- For consistency with @ref Trade::AbstractImporter, @ref Text::AbstractFont + now doesn't fail when opening empty files --- instead this is handled in + the particular plugin implementations + @subsubsection changelog-latest-changes-trade Trade library - The @ref Trade::AnyImageImporter "AnyImageImporter", diff --git a/src/Magnum/Text/AbstractFont.cpp b/src/Magnum/Text/AbstractFont.cpp index f96dd2bda..9332fbd0c 100644 --- a/src/Magnum/Text/AbstractFont.cpp +++ b/src/Magnum/Text/AbstractFont.cpp @@ -63,9 +63,10 @@ AbstractFont::AbstractFont(PluginManager::AbstractManager& manager, const std::s bool AbstractFont::openData(const std::vector>>& data, const Float size) { CORRADE_ASSERT(features() & Feature::OpenData, "Text::AbstractFont::openData(): feature not supported", false); - CORRADE_ASSERT(!data.empty(), - "Text::AbstractFont::openData(): no data passed", false); + /* We accept empty data here (instead of checking for them and failing so + the check doesn't be done on the plugin side) because for some file + formats it could be valid (MagnumFont in particular). */ close(); const Metrics metrics = doOpenData(data, size); _size = metrics.size;