From 0b4a7c7995c9b52cf0404422201ff0e1055d0a64 Mon Sep 17 00:00:00 2001 From: RodrigoDornelles Date: Sun, 10 Nov 2024 12:59:22 -0300 Subject: [PATCH] docs: improve manual --- .gitattributes | 2 ++ .github/workflows/DOCS.yml | 6 ++++++ .gitignore | 1 + Doxyfile | 26 ++++++++++++------------- Makefile | 3 +++ gly_type_render.h | 28 ++++++++++++++++++++++----- tools/doxfilter.cpp | 39 ++++++++++++++++++++++++++++++++++++++ zeebo.css | 26 +++++++++++++++++++++++++ 8 files changed, 113 insertions(+), 18 deletions(-) create mode 100644 tools/doxfilter.cpp create mode 100644 zeebo.css diff --git a/.gitattributes b/.gitattributes index 08ad6c9..b0d74d5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,3 @@ *.h linguist-language=C +*.css linguist-generated +*.cpp linguist-generated diff --git a/.github/workflows/DOCS.yml b/.github/workflows/DOCS.yml index c8c329b..1bc0f3b 100644 --- a/.github/workflows/DOCS.yml +++ b/.github/workflows/DOCS.yml @@ -24,6 +24,12 @@ jobs: - run: | docker run --rm -v $(pwd):/app -w /app rodrigodornelles/doxygen doxygen + - + run: | + make doxfilter + - run: | + rm html/index.html + mv html/gly__type__render_8h.html html/index.html - uses: actions/configure-pages@v3 - diff --git a/.gitignore b/.gitignore index e289fce..c46cf15 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.zip ascii segments +doxfilter html/ latex/ DS_Store diff --git a/Doxyfile b/Doxyfile index 7a4ef6e..cbe338d 100644 --- a/Doxyfile +++ b/Doxyfile @@ -1,26 +1,27 @@ DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = "GlyType" -PROJECT_NUMBER = 0.0.7 +PROJECT_NUMBER = 0.1 PROJECT_BRIEF = "a ultra lightweight font renderer and font" PROJECT_LOGO = OUTPUT_DIRECTORY = . -RECURSIVE = YES +RECURSIVE = NO CREATE_SUBDIRS = NO STRIP_CODE_COMMENTS = NO -CALL_GRAPH = YES -HAVE_DOT = YES -EXTRACT_ALL = YES -USE_MATHJAX = YES -EXTRACT_STATIC = YES +CALL_GRAPH = NO +HAVE_DOT = NO +EXTRACT_ALL = NO +USE_MATHJAX = NO +EXTRACT_STATIC = NO SHORT_NAMES = NO OPTIMIZE_OUTPUT_FOR_C = YES -INLINE_GROUPED_CLASSES = YES -INLINE_SIMPLE_STRUCTS = YES -TYPEDEF_HIDES_STRUCT = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO SOURCE_BROWSER = NO VERBATIM_HEADERS = NO REPEAT_BRIEF = NO PREDEFINED = DOXYGEN= +INPUT_FILTER = ./doxfilter PLANTUML_JAR_PATH = $(PLANTUML_JAR_PATH) PLANTUML_CFG_FILE = PLANTUML_INCLUDE_PATH = @@ -29,9 +30,8 @@ FILE_PATTERNS = *.c *.h EXTENSION_MAPPING = h=c INPUT = gly_type_render.h MARKDOWN_ID_STYLE = GITHUB -# Theme: https://jothepro.github.io/doxygen-awesome-css/ -GENERATE_TREEVIEW = YES +GENERATE_TREEVIEW = NO DISABLE_INDEX = NO FULL_SIDEBAR = NO -HTML_EXTRA_STYLESHEET = $(DOXYGEN_AWESOME_PATH)/doxygen-awesome.css +HTML_EXTRA_STYLESHEET = zeebo.css HTML_COLORSTYLE = LIGHT diff --git a/Makefile b/Makefile index e22a986..8bf39b7 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ all: segments ascii @ +doxfilter: tools/doxfilter.cpp + $(CXX) -I. -o $@ $< -static + ascii: tools/ascii.c gly_type_render.h $(CC) -I. -o $@ tools/ascii.c diff --git a/gly_type_render.h b/gly_type_render.h index a353b44..028f759 100644 --- a/gly_type_render.h +++ b/gly_type_render.h @@ -1,14 +1,14 @@ /** * @file gly_type_render.h - * @short GlyType Renderer + * @short gly_type_render.h * @brief a ultra lightweight font renderer and font * @date 2024 - * @version 0.0.7 + * @version 0.1 * @author RodrigoDornelles * @copyright * This work is free. You can redistribute it and/or modify it under the * terms of the Do What The Fuck You Want To Public License, Version 2, - * as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. + * as published by Sam Hocevar. @n See http://www.wtfpl.net/ for more details. * * @par Style * The font style is inspired by digital displays, but not outdated, @@ -43,21 +43,39 @@ * EEDDDDDDDDDDCC * EDDDDDDDDDDDDC * @endcode + * + * @par Source Code + * + * @sourcecode */ #ifndef H_GLY_TYPE_RENDER #define H_GLY_TYPE_RENDER #ifndef GLY_TYPE_INT +/** + * The @c GLY_TYPE_INT defines the integer type used for coordinates and sizes + * in @ref gly_type_render. + * + * @li @c int but size varies by compiler/architecture. Common in rendering + * libraries. + * @li @c uint8_t suitable for small screens or limited coordinate ranges. + * @li @c uint16_t often ideal for most cases, balancing range and + * memory efficiency. + * + * @par + * @code + * #define GLY_TYPE_INT uint16_t // Recommended for most applications + * @endcode + */ #define GLY_TYPE_INT unsigned char #endif #ifdef DOXYGEN /** - * @short safety * @details * The @c GLY_TYPE_SAFE macro enables a length parameter to ensure safe string - * handling in the `gly_type_render` function. When defined, it activates an + * handling in the @ref gly_type_render function. When defined, it activates an * additional check to limit the number of processed characters, preventing * access beyond the string's end. */ diff --git a/tools/doxfilter.cpp b/tools/doxfilter.cpp new file mode 100644 index 0000000..6a4fae4 --- /dev/null +++ b/tools/doxfilter.cpp @@ -0,0 +1,39 @@ +#include +#include +#include + +int main(int argc, char* argv[]) { + if (argc != 2) { + return 1; + } + + std::string line; + std::ifstream file(argv[1]); + std::stringstream sourcecode; + std::regex pattern_source("@sourcecode"); + std::regex pattern_comments("^(\\/\\*|\\*\\/|\\s\\*)"); + + if (!file.is_open()) { + return 2; + } + + while (std::getline(file, line)) { + if (!std::regex_search(line, pattern_comments)) { + sourcecode << line << std::endl; + } + } + + file.clear(); + file.seekg(0, std::ios::beg); + + while (std::getline(file, line)) { + if (std::regex_search(line, pattern_source)) { + std::cout << "@code\n" << sourcecode.str() << "\n@endcode" << std::endl; + } else { + std::cout << line << std::endl; + } + } + + file.close(); + return 0; +} diff --git a/zeebo.css b/zeebo.css new file mode 100644 index 0000000..fcbdb52 --- /dev/null +++ b/zeebo.css @@ -0,0 +1,26 @@ +#main-nav { + display: none; +} + +.header { + display: none; +} + +.footer { + display: none; +} + +.contents p:first-of-type a:nth-of-type(2) { + display: none; +} + +#doc-content { + max-width: 822px; + margin: 0 auto; +} + +.memitem, .memdoc, dl.reflist dd { + box-shadow: none !important; + -webkit-box-shadow: none !important; + -moz-box-shadow: none !important; +}