mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:07:35 +00:00
LibGfx: Remove static load_from_file() from abstract Font class
This commit is contained in:
parent
79dfe9846d
commit
b8c25bc7ff
6 changed files with 4 additions and 47 deletions
|
@ -10,7 +10,6 @@ set(SOURCES
|
|||
Color.cpp
|
||||
DisjointRectSet.cpp
|
||||
Emoji.cpp
|
||||
Font.cpp
|
||||
FontDatabase.cpp
|
||||
GIFLoader.cpp
|
||||
ICOLoader.cpp
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Stephan Unverwerth <s.unverwerth@gmx.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <LibGfx/BitmapFont.h>
|
||||
#include <LibGfx/Font.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
RefPtr<Font> Font::load_from_file(const StringView& path)
|
||||
{
|
||||
if (path.ends_with(".font")) {
|
||||
return BitmapFont::load_from_file(path);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
|
@ -103,8 +103,6 @@ private:
|
|||
|
||||
class Font : public RefCounted<Font> {
|
||||
public:
|
||||
static RefPtr<Font> load_from_file(const StringView& path);
|
||||
|
||||
virtual NonnullRefPtr<Font> clone() const = 0;
|
||||
virtual ~Font() {};
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ FontDatabase::FontDatabase()
|
|||
|
||||
auto path = String::format("/res/fonts/%s", name.characters());
|
||||
if (name.ends_with(".font")) {
|
||||
if (auto font = Gfx::Font::load_from_file(path)) {
|
||||
if (auto font = Gfx::BitmapFont::load_from_file(path)) {
|
||||
m_private->full_name_to_font_map.set(font->qualified_name(), font);
|
||||
auto typeface = get_or_create_typeface(font->family(), font->variant());
|
||||
typeface->add_bitmap_font(font);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue