changes, working on font
parent
a9339280a0
commit
9fc44188cc
|
@ -1,7 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
include(FetchContent)
|
||||
|
||||
set(BLT_GRAPHICS_VERSION 1.0.2)
|
||||
set(BLT_GRAPHICS_VERSION 1.0.3)
|
||||
set(BLT_GRAPHICS_TEST_VERSION 0.0.1)
|
||||
|
||||
project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION})
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
#pragma once
|
||||
/*
|
||||
* Copyright (C) 2024 Brett Terpstra
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "blt/std/types.h"
|
||||
|
||||
#ifndef BLT_WITH_GRAPHICS_FONT_H
|
||||
#define BLT_WITH_GRAPHICS_FONT_H
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace blt::gfx::font
|
||||
{
|
||||
extern const unsigned int default_font_compressed_data[];
|
||||
extern const unsigned int default_font_compressed_size;
|
||||
|
||||
FT_Library* init();
|
||||
|
||||
inline void destroy(FT_Library* lib)
|
||||
{
|
||||
FT_Done_FreeType(*lib);
|
||||
}
|
||||
|
||||
class font_face_t
|
||||
{
|
||||
public:
|
||||
explicit font_face_t(FT_Library* lib, std::string_view path);
|
||||
|
||||
explicit font_face_t(FT_Library* lib, blt::u8* data, blt::size_t size, bool compressed = false);
|
||||
|
||||
font_face_t& set_pixel_sizes(blt::u32 width, blt::u32 height);
|
||||
|
||||
std::optional<int> load_char(char c);
|
||||
|
||||
[[nodiscard]] FT_Face* get() const
|
||||
{
|
||||
return face.get();
|
||||
}
|
||||
|
||||
private:
|
||||
// decompressed data ownership
|
||||
std::shared_ptr<blt::u8> internal_uncompressed_data;
|
||||
std::shared_ptr<FT_Face> face;
|
||||
};
|
||||
|
||||
struct font_file_t
|
||||
{
|
||||
std::string_view path;
|
||||
blt::u32 character_min_index;
|
||||
blt::u32 character_max_index;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //BLT_WITH_GRAPHICS_FONT_H
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
/*
|
||||
* Copyright (C) 2024 Brett Terpstra
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BLT_WITH_GRAPHICS_FONT_AWESOME_DEFINES_H
|
||||
#define BLT_WITH_GRAPHICS_FONT_AWESOME_DEFINES_H
|
||||
|
||||
extern const char fontAwesomeRegular_compressed_data_base85[];
|
||||
extern const unsigned int fontAwesomeSolid_compressed_data[];
|
||||
extern const unsigned int fontAwesomeBrands_compressed_data[];
|
||||
|
||||
extern const unsigned int fontAwesomeRegular_compressed_size;
|
||||
extern const unsigned int fontAwesomeSolid_compressed_size;
|
||||
extern const unsigned int fontAwesomeBrands_compressed_size;
|
||||
|
||||
|
||||
#endif //BLT_WITH_GRAPHICS_FONT_AWESOME_DEFINES_H
|
|
@ -1,15 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include "IconsFontAwesome5.h" // from https://github.com/juliettef/IconFontCppHeaders
|
||||
#include "blt/gfx/font/IconsFontAwesome5.h" // from https://github.com/juliettef/IconFontCppHeaders
|
||||
#include <blt/gfx/font/font_awesome_defines.h>
|
||||
#include "imgui_spectrum.h"
|
||||
#include <imgui.h>
|
||||
#include <cmath>
|
||||
|
||||
extern const char fontAwesomeRegular_compressed_data_base85[];
|
||||
extern const unsigned int fontAwesomeSolid_compressed_data[];
|
||||
extern const unsigned int fontAwesomeSolid_compressed_size;
|
||||
extern const unsigned int fontAwesomeBrands_compressed_size;
|
||||
extern const unsigned int fontAwesomeBrands_compressed_data[];
|
||||
namespace ImGui
|
||||
{
|
||||
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
/*
|
||||
* Copyright (C) 2024 Brett Terpstra
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BLT_WITH_GRAPHICS_FONT_RENDERER_H
|
||||
#define BLT_WITH_GRAPHICS_FONT_RENDERER_H
|
||||
|
||||
#include <blt/gfx/font/font.h>
|
||||
|
||||
namespace blt::gfx
|
||||
{
|
||||
|
||||
|
||||
|
||||
class font_renderer_t
|
||||
{
|
||||
public:
|
||||
explicit font_renderer_t();
|
||||
private:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //BLT_WITH_GRAPHICS_FONT_RENDERER_H
|
|
@ -1 +1 @@
|
|||
Subproject commit ea16aa384747fa66abf234f0156981f6b736c929
|
||||
Subproject commit 7bf24a11a53d345b58a7437a1b9768f2da78eeb2
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* <Short Description>
|
||||
* Copyright (C) 2024 Brett Terpstra
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <blt/gfx/renderer/font_renderer.h>
|
||||
|
||||
namespace blt::gfx
|
||||
{
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
#include <blt/std/logging.h>
|
||||
#include <blt/std/time.h>
|
||||
#include <blt/gfx/input.h>
|
||||
#include <blt/gfx/font/font.h>
|
||||
#include <queue>
|
||||
#include <imgui.h>
|
||||
#include "backends/imgui_impl_opengl3.h"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue