├── Terminal ├── Include │ └── Python │ │ ├── bearlibterminal │ │ └── __init__.py │ │ ├── setup.py │ │ ├── PACKAGE.rst │ │ └── README.md ├── Resource │ ├── Terminal.rc │ ├── Terminal.ico │ ├── Terminal-32bit.res │ └── Terminal-64bit.res ├── Dependencies │ ├── FreeType │ │ ├── Source │ │ │ ├── autofit │ │ │ │ ├── afangles.h │ │ │ │ ├── module.mk │ │ │ │ ├── Jamfile │ │ │ │ ├── afmodule.h │ │ │ │ ├── aflatin2.h │ │ │ │ ├── afindic.h │ │ │ │ ├── autofit.c │ │ │ │ ├── afdummy.h │ │ │ │ ├── aferrors.h │ │ │ │ ├── afwarp.h │ │ │ │ ├── afdummy.c │ │ │ │ ├── rules.mk │ │ │ │ └── afloader.h │ │ │ ├── raster │ │ │ │ ├── module.mk │ │ │ │ ├── Jamfile │ │ │ │ ├── raster.c │ │ │ │ ├── ftrend1.h │ │ │ │ ├── rules.mk │ │ │ │ ├── ftraster.h │ │ │ │ ├── rasterrs.h │ │ │ │ └── rastpic.h │ │ │ ├── sfnt │ │ │ │ ├── module.mk │ │ │ │ ├── Jamfile │ │ │ │ ├── sfdriver.h │ │ │ │ ├── sfnt.c │ │ │ │ ├── ttbdf.h │ │ │ │ ├── ttpost.h │ │ │ │ ├── sferrors.h │ │ │ │ ├── ttkern.h │ │ │ │ ├── ttcmapc.h │ │ │ │ ├── sfobjs.h │ │ │ │ ├── ttmtx.h │ │ │ │ └── rules.mk │ │ │ ├── smooth │ │ │ │ ├── Jamfile │ │ │ │ ├── module.mk │ │ │ │ ├── smooth.c │ │ │ │ ├── ftsmooth.h │ │ │ │ ├── rules.mk │ │ │ │ ├── ftsmerrs.h │ │ │ │ ├── ftgrays.h │ │ │ │ └── ftspic.h │ │ │ ├── truetype │ │ │ │ ├── module.mk │ │ │ │ ├── Jamfile │ │ │ │ ├── ttdriver.h │ │ │ │ ├── truetype.c │ │ │ │ ├── rules.mk │ │ │ │ ├── tterrors.h │ │ │ │ ├── ttgload.h │ │ │ │ ├── ttpload.h │ │ │ │ └── ttpic.h │ │ │ └── base │ │ │ │ ├── Jamfile │ │ │ │ ├── ftxf86.c │ │ │ │ ├── ftbase.c │ │ │ │ ├── ftwinfnt.c │ │ │ │ ├── ftpic.c │ │ │ │ ├── ftgasp.c │ │ │ │ └── ftfstype.c │ │ ├── CMakeLists.txt │ │ └── Include │ │ │ ├── freetype │ │ │ ├── config │ │ │ │ └── ftmodule.h │ │ │ ├── internal │ │ │ │ ├── services │ │ │ │ │ ├── svtteng.h │ │ │ │ │ ├── svwinfnt.h │ │ │ │ │ ├── svkern.h │ │ │ │ │ ├── svotval.h │ │ │ │ │ ├── svxf86nm.h │ │ │ │ │ ├── svpfr.h │ │ │ │ │ └── svttglyf.h │ │ │ │ └── ftpic.h │ │ │ └── ttunpat.h │ │ │ └── ft2build.h │ └── PicoPNG │ │ └── CMakeLists.txt └── Source │ ├── Base64.hpp │ ├── LoadBitmap.hpp │ ├── Resource.hpp │ ├── Keystroke.cpp │ ├── BitmapTileset.hpp │ ├── Keystroke.hpp │ ├── Palette.hpp │ ├── OptionGroup.hpp │ ├── DynamicTileset.hpp │ ├── BOM.hpp │ ├── OpenGL.cpp │ ├── OpenGL.hpp │ ├── Options.cpp │ ├── Texture.hpp │ ├── TrueTypeTileset.hpp │ ├── Point.hpp │ ├── Stage.cpp │ ├── Options.hpp │ ├── CocoaWindow.h │ ├── Log.hpp │ ├── LoadBitmap.cpp │ ├── Window.cpp │ ├── Stage.hpp │ └── Color.hpp ├── Build └── README.md ├── .hgignore ├── Samples └── Omni │ ├── Source │ ├── Common.cpp │ ├── WindowsGlyphList4.hpp │ ├── WindowResize.cpp │ ├── Common.hpp │ ├── Layers.cpp │ ├── MultipleFonts.cpp │ ├── BasicOutput.cpp │ ├── Sprites.cpp │ ├── AutoGenerated.cpp │ ├── DefaultFont.cpp │ ├── Pick.cpp │ ├── Tilesets.cpp │ ├── ManualCellsize.cpp │ └── InputFiltering.cpp │ └── CMakeLists.txt ├── CMakeLists.txt └── LICENSE.txt /Terminal/Include/Python/bearlibterminal/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Terminal/Resource/Terminal.rc: -------------------------------------------------------------------------------- 1 | 100 ICON Terminal.ico 2 | -------------------------------------------------------------------------------- /Build/README.md: -------------------------------------------------------------------------------- 1 | Use this directory for CMake-generated makefiles. -------------------------------------------------------------------------------- /.hgignore: -------------------------------------------------------------------------------- 1 | syntax: regexp 2 | Build/.* 3 | Output/[a-zA-Z0-9_.]+ 4 | .settings/.* 5 | .cproject 6 | .project 7 | -------------------------------------------------------------------------------- /Terminal/Resource/Terminal.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfyzium/bearlibterminal/HEAD/Terminal/Resource/Terminal.ico -------------------------------------------------------------------------------- /Terminal/Resource/Terminal-32bit.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfyzium/bearlibterminal/HEAD/Terminal/Resource/Terminal-32bit.res -------------------------------------------------------------------------------- /Terminal/Resource/Terminal-64bit.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfyzium/bearlibterminal/HEAD/Terminal/Resource/Terminal-64bit.res -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/afangles.h: -------------------------------------------------------------------------------- 1 | /* 2 | * afangles.h 3 | * 4 | * This is a dummy file, used to please the build system. It is never 5 | * included by the auto-fitter sources. 6 | * 7 | */ 8 | -------------------------------------------------------------------------------- /Terminal/Dependencies/PicoPNG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | project(picopng) 4 | 5 | set(SOURCES ./Source/PicoPNG.cpp) 6 | 7 | include_directories(./Include) 8 | 9 | if (UNIX) 10 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") 11 | endif() 12 | 13 | add_library(picopng STATIC ${SOURCES}) 14 | -------------------------------------------------------------------------------- /Samples/Omni/Source/Common.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Common.cpp 3 | * 4 | * Created on: Nov 27, 2013 5 | * Author: cfyz 6 | */ 7 | 8 | #include "Common.hpp" 9 | 10 | #if defined(_WIN32) 11 | #include 12 | uint64_t GetTime() 13 | { 14 | return timeGetTime(); 15 | } 16 | #endif 17 | #if defined(__linux) || defined(__APPLE__) 18 | #include 19 | #include 20 | uint64_t GetTime() 21 | { 22 | timeval t; 23 | gettimeofday(&t, nullptr); 24 | return t.tv_sec*1000 + t.tv_usec/1000; 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/raster/module.mk: -------------------------------------------------------------------------------- 1 | # 2 | # FreeType 2 renderer module definition 3 | # 4 | 5 | 6 | # Copyright 1996-2000, 2006 by 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. 8 | # 9 | # This file is part of the FreeType project, and may only be used, modified, 10 | # and distributed under the terms of the FreeType project license, 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 12 | # indicate that you have read the license and understand and accept it 13 | # fully. 14 | 15 | 16 | FTMODULE_H_COMMANDS += RASTER_MODULE 17 | 18 | define RASTER_MODULE 19 | $(OPEN_DRIVER) FT_Renderer_Class, ft_raster1_renderer_class $(CLOSE_DRIVER) 20 | $(ECHO_DRIVER)raster $(ECHO_DRIVER_DESC)monochrome bitmap renderer$(ECHO_DRIVER_DONE) 21 | endef 22 | 23 | # EOF 24 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/module.mk: -------------------------------------------------------------------------------- 1 | # 2 | # FreeType 2 SFNT module definition 3 | # 4 | 5 | 6 | # Copyright 1996-2000, 2006 by 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. 8 | # 9 | # This file is part of the FreeType project, and may only be used, modified, 10 | # and distributed under the terms of the FreeType project license, 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 12 | # indicate that you have read the license and understand and accept it 13 | # fully. 14 | 15 | 16 | FTMODULE_H_COMMANDS += SFNT_MODULE 17 | 18 | define SFNT_MODULE 19 | $(OPEN_DRIVER) FT_Module_Class, sfnt_module_class $(CLOSE_DRIVER) 20 | $(ECHO_DRIVER)sfnt $(ECHO_DRIVER_DESC)helper module for TrueType & OpenType formats$(ECHO_DRIVER_DONE) 21 | endef 22 | 23 | # EOF 24 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/module.mk: -------------------------------------------------------------------------------- 1 | # 2 | # FreeType 2 auto-fitter module definition 3 | # 4 | 5 | 6 | # Copyright 2003, 2004, 2005, 2006 by 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. 8 | # 9 | # This file is part of the FreeType project, and may only be used, modified, 10 | # and distributed under the terms of the FreeType project license, 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 12 | # indicate that you have read the license and understand and accept it 13 | # fully. 14 | 15 | 16 | FTMODULE_H_COMMANDS += AUTOFIT_MODULE 17 | 18 | define AUTOFIT_MODULE 19 | $(OPEN_DRIVER) FT_Module_Class, autofit_module_class $(CLOSE_DRIVER) 20 | $(ECHO_DRIVER)autofit $(ECHO_DRIVER_DESC)automatic hinting module$(ECHO_DRIVER_DONE) 21 | endef 22 | 23 | # EOF 24 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/raster/Jamfile: -------------------------------------------------------------------------------- 1 | # FreeType 2 src/raster Jamfile 2 | # 3 | # Copyright 2001 by 4 | # David Turner, Robert Wilhelm, and Werner Lemberg. 5 | # 6 | # This file is part of the FreeType project, and may only be used, modified, 7 | # and distributed under the terms of the FreeType project license, 8 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 9 | # indicate that you have read the license and understand and accept it 10 | # fully. 11 | 12 | SubDir FT2_TOP $(FT2_SRC_DIR) raster ; 13 | 14 | { 15 | local _sources ; 16 | 17 | if $(FT2_MULTI) 18 | { 19 | _sources = ftraster ftrend1 rastpic ; 20 | } 21 | else 22 | { 23 | _sources = raster ; 24 | } 25 | 26 | Library $(FT2_LIB) : $(_sources).c ; 27 | } 28 | 29 | # end of src/raster Jamfile 30 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/smooth/Jamfile: -------------------------------------------------------------------------------- 1 | # FreeType 2 src/smooth Jamfile 2 | # 3 | # Copyright 2001 by 4 | # David Turner, Robert Wilhelm, and Werner Lemberg. 5 | # 6 | # This file is part of the FreeType project, and may only be used, modified, 7 | # and distributed under the terms of the FreeType project license, 8 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 9 | # indicate that you have read the license and understand and accept it 10 | # fully. 11 | 12 | SubDir FT2_TOP $(FT2_SRC_DIR) smooth ; 13 | 14 | { 15 | local _sources ; 16 | 17 | if $(FT2_MULTI) 18 | { 19 | _sources = ftgrays ftsmooth ftspic ; 20 | } 21 | else 22 | { 23 | _sources = smooth ; 24 | } 25 | 26 | Library $(FT2_LIB) : $(_sources).c ; 27 | } 28 | 29 | # end of src/smooth Jamfile 30 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/truetype/module.mk: -------------------------------------------------------------------------------- 1 | # 2 | # FreeType 2 TrueType module definition 3 | # 4 | 5 | 6 | # Copyright 1996-2000, 2006 by 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. 8 | # 9 | # This file is part of the FreeType project, and may only be used, modified, 10 | # and distributed under the terms of the FreeType project license, 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 12 | # indicate that you have read the license and understand and accept it 13 | # fully. 14 | 15 | 16 | FTMODULE_H_COMMANDS += TRUETYPE_DRIVER 17 | 18 | define TRUETYPE_DRIVER 19 | $(OPEN_DRIVER) FT_Driver_ClassRec, tt_driver_class $(CLOSE_DRIVER) 20 | $(ECHO_DRIVER)truetype $(ECHO_DRIVER_DESC)Windows/Mac font files with extension *.ttf or *.ttc$(ECHO_DRIVER_DONE) 21 | endef 22 | 23 | # EOF 24 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | project(BearLibTerminal) 4 | 5 | if (NOT ((${CMAKE_SYSTEM_NAME} MATCHES "Linux") OR (${CMAKE_SYSTEM_NAME} MATCHES "Windows") OR (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))) 6 | message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} is not supported.") 7 | endif() 8 | 9 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 10 | message(STATUS "Build type was not specified, switching to 'Release'") 11 | set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) 12 | 13 | # Set the possible values of build type for cmake-gui 14 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") 15 | endif() 16 | 17 | add_subdirectory(./Terminal) 18 | 19 | if(IS_DIRECTORY "${CMAKE_SOURCE_DIR}/Samples") 20 | add_subdirectory(./Samples/Omni) 21 | endif() 22 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/truetype/Jamfile: -------------------------------------------------------------------------------- 1 | # FreeType 2 src/truetype Jamfile 2 | # 3 | # Copyright 2001, 2004 by 4 | # David Turner, Robert Wilhelm, and Werner Lemberg. 5 | # 6 | # This file is part of the FreeType project, and may only be used, modified, 7 | # and distributed under the terms of the FreeType project license, 8 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 9 | # indicate that you have read the license and understand and accept it 10 | # fully. 11 | 12 | SubDir FT2_TOP $(FT2_SRC_DIR) truetype ; 13 | 14 | { 15 | local _sources ; 16 | 17 | if $(FT2_MULTI) 18 | { 19 | _sources = ttdriver ttobjs ttpload ttgload ttinterp ttgxvar ttpic ; 20 | } 21 | else 22 | { 23 | _sources = truetype ; 24 | } 25 | 26 | Library $(FT2_LIB) : $(_sources).c ; 27 | } 28 | 29 | # end of src/truetype Jamfile 30 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/Jamfile: -------------------------------------------------------------------------------- 1 | # FreeType 2 src/sfnt Jamfile 2 | # 3 | # Copyright 2001, 2002, 2004, 2005 by 4 | # David Turner, Robert Wilhelm, and Werner Lemberg. 5 | # 6 | # This file is part of the FreeType project, and may only be used, modified, 7 | # and distributed under the terms of the FreeType project license, 8 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 9 | # indicate that you have read the license and understand and accept it 10 | # fully. 11 | 12 | SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ; 13 | 14 | { 15 | local _sources ; 16 | 17 | if $(FT2_MULTI) 18 | { 19 | _sources = sfobjs sfdriver ttcmap ttmtx ttpost ttload ttsbit ttkern ttbdf sfntpic ; 20 | } 21 | else 22 | { 23 | _sources = sfnt ; 24 | } 25 | 26 | Library $(FT2_LIB) : $(_sources).c ; 27 | } 28 | 29 | # end of src/sfnt Jamfile 30 | -------------------------------------------------------------------------------- /Samples/Omni/Source/WindowsGlyphList4.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * WindowsGlyphList4.hpp 3 | * 4 | * Created on: Nov 27, 2013 5 | * Author: cfyz 6 | */ 7 | 8 | #ifndef WINDOWSGLYPHLIST4_HPP_ 9 | #define WINDOWSGLYPHLIST4_HPP_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | struct UnicodeRange 16 | { 17 | std::string name; 18 | int start, end; 19 | std::set codes; 20 | 21 | UnicodeRange(const std::string& name, int start, int end): 22 | name(name), 23 | start(start), 24 | end(end) 25 | { } 26 | 27 | UnicodeRange& Add(int code) 28 | { 29 | codes.insert(code); 30 | return *this; 31 | } 32 | 33 | UnicodeRange& Add(int from, int to) 34 | { 35 | for (int i=from; i<=to; i++) codes.insert(i); 36 | return *this; 37 | } 38 | }; 39 | 40 | extern std::vector g_wgl4_ranges; 41 | 42 | #endif /* WINDOWSGLYPHLIST4_HPP_ */ 43 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | project(freetype2) 4 | 5 | set(SOURCES ./Source/autofit/autofit.c 6 | ./Source/base/ftbase.c 7 | ./Source/base/ftbbox.c 8 | ./Source/base/ftdebug.c 9 | ./Source/base/ftfstype.c 10 | ./Source/base/ftgasp.c 11 | ./Source/base/ftglyph.c 12 | ./Source/base/ftinit.c 13 | ./Source/base/ftlcdfil.c 14 | ./Source/base/ftmm.c 15 | ./Source/base/ftsystem.c 16 | ./Source/raster/raster.c 17 | ./Source/sfnt/sfnt.c 18 | ./Source/smooth/smooth.c 19 | ./Source/truetype/truetype.c) 20 | 21 | include_directories(./Include) 22 | 23 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFT2_BUILD_LIBRARY") 24 | if (UNIX) 25 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") 26 | endif() 27 | 28 | add_library(freetype2 STATIC ${SOURCES}) 29 | -------------------------------------------------------------------------------- /Samples/Omni/Source/WindowResize.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * WindowResize.cpp 3 | * 4 | * Created on: Jan 9, 2014 5 | * Author: cfyz 6 | */ 7 | 8 | #include "Common.hpp" 9 | 10 | void TestWindowResize() 11 | { 12 | terminal_set("window: title='Omni: window resizing', resizeable=true, minimum-size=27x5"); 13 | 14 | const int symbol = 0x2588; 15 | 16 | while (true) 17 | { 18 | terminal_clear(); 19 | int w = terminal_state(TK_WIDTH); 20 | int h = terminal_state(TK_HEIGHT); 21 | for (int x=0; x 13 | #include 14 | 15 | uint64_t GetTime(); 16 | 17 | template std::string to_string(const T& value) 18 | { 19 | std::ostringstream ss; 20 | ss << value; 21 | return ss.str(); 22 | } 23 | 24 | void TestBasicOutput(); 25 | void TestDefaultFont(); 26 | void TestTilesets(); 27 | void TestSprites(); 28 | void TestManualCellsize(); 29 | void TestAutoGenerated(); 30 | void TestMultipleFonts(); 31 | void TestTextAlignment(); 32 | void TestFormattedLog(); 33 | void TestFontViewer(); 34 | void TestLayers(); 35 | void TestExtendedBasics(); 36 | void TestExtendedInterlayer(); 37 | void TestExtendedSmoothScroll(); 38 | void TestDynamicSprites(); 39 | void TestSpeed(); 40 | void TestKeyboard(); 41 | void TestMouse(); 42 | void TestTextInput(); 43 | void TestInputFiltering(); 44 | void TestWindowResize(); 45 | void TestPick(); 46 | 47 | #endif /* COMMON_HPP_ */ 48 | -------------------------------------------------------------------------------- /Samples/Omni/Source/Layers.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Layers.cpp 3 | * 4 | * Created on: Dec 9, 2013 5 | * Author: Cfyz 6 | */ 7 | 8 | #include "Common.hpp" 9 | 10 | void TestLayers() 11 | { 12 | terminal_set("window.title='Omni: layers'"); 13 | 14 | color_t pixel = color_from_name("dark gray"); 15 | terminal_setf("U+E000: %#p, raw-size=1x1, resize=48x48, resize-filter=nearest", &pixel); 16 | 17 | while (true) 18 | { 19 | terminal_clear(); 20 | terminal_color("white"); 21 | 22 | terminal_print(2, 1, "[color=orange]1.[/color] Without layers:"); 23 | terminal_put(7, 3, 0xE000); 24 | terminal_print(5, 4, "[color=dark green]abcdefghij"); 25 | 26 | terminal_print(2, 8, "[color=orange]2.[/color] With layers:"); 27 | terminal_layer(1); 28 | terminal_put(7, 10, 0xE000); 29 | terminal_layer(0); 30 | terminal_print(5, 11, "[color=dark green]abcdefghij"); 31 | 32 | terminal_refresh(); 33 | 34 | int key = terminal_read(); 35 | 36 | if (key == TK_CLOSE || key == TK_ESCAPE) 37 | { 38 | break; 39 | } 40 | } 41 | 42 | terminal_set("U+E000: none"); 43 | } 44 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/Jamfile: -------------------------------------------------------------------------------- 1 | # FreeType 2 src/autofit Jamfile 2 | # 3 | # Copyright 2003, 2004, 2005, 2006, 2007, 2009 by 4 | # David Turner, Robert Wilhelm, and Werner Lemberg. 5 | # 6 | # This file is part of the FreeType project, and may only be used, modified, 7 | # and distributed under the terms of the FreeType project license, 8 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 9 | # indicate that you have read the license and understand and accept it 10 | # fully. 11 | 12 | SubDir FT2_TOP src autofit ; 13 | 14 | { 15 | local _sources ; 16 | 17 | # define FT2_AUTOFIT2 to enable experimental latin hinter replacement 18 | if $(FT2_AUTOFIT2) 19 | { 20 | DEFINES += FT_OPTION_AUTOFIT2 ; 21 | } 22 | if $(FT2_MULTI) 23 | { 24 | _sources = afangles afglobal afhints aflatin afcjk afindic afloader afmodule afdummy afwarp afpic ; 25 | 26 | if $(FT2_AUTOFIT2) 27 | { 28 | _sources += aflatin2 ; 29 | } 30 | } 31 | else 32 | { 33 | _sources = autofit ; 34 | } 35 | 36 | Library $(FT2_LIB) : $(_sources).c ; 37 | } 38 | 39 | # end of src/autofit Jamfile 40 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/smooth/module.mk: -------------------------------------------------------------------------------- 1 | # 2 | # FreeType 2 smooth renderer module definition 3 | # 4 | 5 | 6 | # Copyright 1996-2000, 2006 by 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. 8 | # 9 | # This file is part of the FreeType project, and may only be used, modified, 10 | # and distributed under the terms of the FreeType project license, 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 12 | # indicate that you have read the license and understand and accept it 13 | # fully. 14 | 15 | 16 | FTMODULE_H_COMMANDS += SMOOTH_RENDERER 17 | 18 | define SMOOTH_RENDERER 19 | $(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_renderer_class $(CLOSE_DRIVER) 20 | $(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer$(ECHO_DRIVER_DONE) 21 | $(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcd_renderer_class $(CLOSE_DRIVER) 22 | $(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for LCDs$(ECHO_DRIVER_DONE) 23 | $(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcdv_renderer_class $(CLOSE_DRIVER) 24 | $(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for vertical LCDs$(ECHO_DRIVER_DONE) 25 | endef 26 | 27 | # EOF 28 | -------------------------------------------------------------------------------- /Samples/Omni/Source/MultipleFonts.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * MultipleFonts.cpp 3 | * 4 | * Created on: Nov 28, 2013 5 | * Author: cfyz 6 | */ 7 | 8 | #include "Common.hpp" 9 | 10 | void TestMultipleFonts() 11 | { 12 | terminal_set("window.title='Omni: multiple fonts in scene'"); 13 | 14 | // Load several fonts 15 | terminal_set("window.size=64x20; font: ../Media/VeraMono.ttf, size=10x20"); 16 | terminal_set("italic font: ../Media/VeraMoIt.ttf, size=10x20"); 17 | terminal_set("bold font: ../Media/VeraMoBd.ttf, size=10x20"); 18 | terminal_set("huge font: ../Media/VeraMono.ttf, size=20x40, spacing=2x2"); 19 | 20 | terminal_clear(); 21 | terminal_color("white"); 22 | int h = terminal_print_ext 23 | ( 24 | 2, 1, 60, 0, TK_ALIGN_DEFAULT, 25 | "If you [color=orange][font=italic]really[/font][/color] want, " 26 | "you can even put [color=orange][font=bold]emphasis[/font][/color] on a text. " 27 | "This works by loading several truetype tilesets with custom codepages to an " 28 | "unused code points and using [color=orange]font[/color] postformatting tag." 29 | ).height; 30 | 31 | terminal_print_ext 32 | ( 33 | 2, 1+h+1, 60, 0, TK_ALIGN_DEFAULT, 34 | "[font=huge]It's pretty easy to print in bigger fonts as well." 35 | ); 36 | terminal_refresh(); 37 | 38 | for (int key=0; key!=TK_CLOSE && key!=TK_ESCAPE; key=terminal_read()); 39 | 40 | // Clean up 41 | terminal_set("window.size=80x25; font: default; italic font: none; bold font: none; huge font: none"); 42 | } 43 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/raster/raster.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* raster.c */ 4 | /* */ 5 | /* FreeType monochrome rasterer module component (body only). */ 6 | /* */ 7 | /* Copyright 1996-2001 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #define FT_MAKE_OPTION_SINGLE_OBJECT 20 | 21 | #include 22 | #include "rastpic.c" 23 | #include "ftraster.c" 24 | #include "ftrend1.c" 25 | 26 | 27 | /* END */ 28 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/smooth/smooth.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* smooth.c */ 4 | /* */ 5 | /* FreeType anti-aliasing rasterer module component (body only). */ 6 | /* */ 7 | /* Copyright 1996-2001 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #define FT_MAKE_OPTION_SINGLE_OBJECT 20 | 21 | #include 22 | #include "ftspic.c" 23 | #include "ftgrays.c" 24 | #include "ftsmooth.c" 25 | 26 | 27 | /* END */ 28 | -------------------------------------------------------------------------------- /Terminal/Source/Base64.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BEARLIBTERMINAL_BASE64_HPP 24 | #define BEARLIBTERMINAL_BASE64_HPP 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace BearLibTerminal 31 | { 32 | class Base64 33 | { 34 | public: 35 | static std::vector Decode(const std::string& s); 36 | }; 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Terminal/Source/LoadBitmap.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BEARLIBTERMINAL_LOADBITMAP_HPP 24 | #define BEARLIBTERMINAL_LOADBITMAP_HPP 25 | 26 | #include 27 | #include 28 | #include 29 | #include "Bitmap.hpp" 30 | 31 | namespace BearLibTerminal 32 | { 33 | Bitmap LoadBitmap(const std::vector& data); 34 | } 35 | 36 | #endif // BEARLIBTERMINAL_LOADBITMAP_HPP 37 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Include/freetype/config/ftmodule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file registers the FreeType modules compiled into the library. 3 | * 4 | * If you use GNU make, this file IS NOT USED! Instead, it is created in 5 | * the objects directory (normally `/objs/') based on information 6 | * from `/modules.cfg'. 7 | * 8 | * Please read `docs/INSTALL.ANY' and `docs/CUSTOMIZE' how to compile 9 | * FreeType without GNU make. 10 | * 11 | */ 12 | 13 | FT_USE_MODULE( FT_Module_Class, autofit_module_class ) 14 | FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) 15 | //FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) 16 | //FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) 17 | //FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) 18 | //FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) 19 | //FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) 20 | //FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) 21 | //FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) 22 | //FT_USE_MODULE( FT_Module_Class, psaux_module_class ) 23 | //FT_USE_MODULE( FT_Module_Class, psnames_module_class ) 24 | //FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) 25 | FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) 26 | FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) 27 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) 28 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) 29 | //FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) 30 | //FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) 31 | 32 | /* EOF */ 33 | -------------------------------------------------------------------------------- /Terminal/Source/Resource.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef RESOURCES_HPP_ 24 | #define RESOURCES_HPP_ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace BearLibTerminal 33 | { 34 | class Resource 35 | { 36 | public: 37 | static std::vector Open(std::wstring name, std::wstring prefix = L""); 38 | }; 39 | } 40 | 41 | #endif /* RESOURCES_HPP_ */ 42 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/sfdriver.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* sfdriver.h */ 4 | /* */ 5 | /* High-level SFNT driver interface (specification). */ 6 | /* */ 7 | /* Copyright 1996-2001 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SFDRIVER_H__ 20 | #define __SFDRIVER_H__ 21 | 22 | 23 | #include 24 | #include FT_MODULE_H 25 | 26 | 27 | FT_BEGIN_HEADER 28 | 29 | 30 | FT_DECLARE_MODULE( sfnt_module_class ) 31 | 32 | 33 | FT_END_HEADER 34 | 35 | #endif /* __SFDRIVER_H__ */ 36 | 37 | 38 | /* END */ 39 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/base/Jamfile: -------------------------------------------------------------------------------- 1 | # FreeType 2 src/base Jamfile 2 | # 3 | # Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by 4 | # David Turner, Robert Wilhelm, and Werner Lemberg. 5 | # 6 | # This file is part of the FreeType project, and may only be used, modified, 7 | # and distributed under the terms of the FreeType project license, 8 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 9 | # indicate that you have read the license and understand and accept it 10 | # fully. 11 | 12 | SubDir FT2_TOP $(FT2_SRC_DIR) base ; 13 | 14 | 15 | { 16 | local _sources ; 17 | 18 | if $(FT2_MULTI) 19 | { 20 | _sources = ftadvanc ftcalc ftdbgmem ftgloadr 21 | ftobjs ftoutln ftrfork ftsnames 22 | ftstream fttrigon ftutil 23 | basepic ftpic 24 | ; 25 | } 26 | else 27 | { 28 | _sources = ftbase ; 29 | } 30 | 31 | Library $(FT2_LIB) : $(_sources).c ; 32 | } 33 | 34 | # Add the optional/replaceable files. 35 | # 36 | { 37 | local _sources = bbox bdf bitmap debug gasp 38 | glyph gxval init lcdfil mm 39 | otval pfr stroke synth system 40 | type1 winfnt xf86 patent 41 | ; 42 | 43 | Library $(FT2_LIB) : ft$(_sources).c ; 44 | } 45 | 46 | # Add Macintosh-specific file to the library when necessary. 47 | # 48 | if $(MAC) 49 | { 50 | Library $(FT2_LIB) : ftmac.c ; 51 | } 52 | else if $(OS) = MACOSX 53 | { 54 | if $(FT2_MULTI) 55 | { 56 | Library $(FT2_LIB) : ftmac.c ; 57 | } 58 | } 59 | 60 | # end of src/base Jamfile 61 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/truetype/ttdriver.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttdriver.h */ 4 | /* */ 5 | /* High-level TrueType driver interface (specification). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2002 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __TTDRIVER_H__ 20 | #define __TTDRIVER_H__ 21 | 22 | 23 | #include 24 | #include FT_INTERNAL_DRIVER_H 25 | 26 | 27 | FT_BEGIN_HEADER 28 | 29 | 30 | FT_DECLARE_DRIVER( tt_driver_class ) 31 | 32 | 33 | FT_END_HEADER 34 | 35 | #endif /* __TTDRIVER_H__ */ 36 | 37 | 38 | /* END */ 39 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/afmodule.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* afmodule.h */ 4 | /* */ 5 | /* Auto-fitter module implementation (specification). */ 6 | /* */ 7 | /* Copyright 2003, 2004, 2005 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __AFMODULE_H__ 20 | #define __AFMODULE_H__ 21 | 22 | #include 23 | #include FT_INTERNAL_OBJECTS_H 24 | #include FT_MODULE_H 25 | 26 | 27 | FT_BEGIN_HEADER 28 | 29 | FT_DECLARE_MODULE(autofit_module_class) 30 | 31 | 32 | FT_END_HEADER 33 | 34 | #endif /* __AFMODULE_H__ */ 35 | 36 | 37 | /* END */ 38 | -------------------------------------------------------------------------------- /Terminal/Source/Keystroke.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2015 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #define BEARLIBTERMINAL_BUILDING_LIBRARY 24 | #include "BearLibTerminal.h" 25 | #include "Keystroke.hpp" 26 | #include 27 | 28 | namespace BearLibTerminal 29 | { 30 | Event::Event(int code): 31 | code(code) 32 | { } 33 | 34 | Event::Event(int code, std::unordered_map properties): 35 | code(code), 36 | properties(std::move(properties)) 37 | { } 38 | 39 | int& Event::operator[](int index) 40 | { 41 | return properties[index]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/aflatin2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* aflatin2.h */ 4 | /* */ 5 | /* Auto-fitter hinting routines for latin script (specification). */ 6 | /* */ 7 | /* Copyright 2003, 2004, 2005, 2006, 2007 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __AFLATIN2_H__ 20 | #define __AFLATIN2_H__ 21 | 22 | #include "afhints.h" 23 | 24 | 25 | FT_BEGIN_HEADER 26 | 27 | 28 | /* the latin-specific script class */ 29 | 30 | AF_DECLARE_SCRIPT_CLASS(af_latin2_script_class) 31 | 32 | /* */ 33 | 34 | FT_END_HEADER 35 | 36 | #endif /* __AFLATIN_H__ */ 37 | 38 | 39 | /* END */ 40 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/afindic.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* afindic.h */ 4 | /* */ 5 | /* Auto-fitter hinting routines for Indic scripts (specification). */ 6 | /* */ 7 | /* Copyright 2007 by */ 8 | /* Rahul Bhalerao , . */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __AFINDIC_H__ 20 | #define __AFINDIC_H__ 21 | 22 | #include "afhints.h" 23 | 24 | 25 | FT_BEGIN_HEADER 26 | 27 | 28 | /* the Indic-specific script class */ 29 | 30 | AF_DECLARE_SCRIPT_CLASS(af_indic_script_class) 31 | 32 | 33 | /* */ 34 | 35 | FT_END_HEADER 36 | 37 | #endif /* __AFINDIC_H__ */ 38 | 39 | 40 | /* END */ 41 | -------------------------------------------------------------------------------- /Samples/Omni/Source/BasicOutput.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BasicOutput.cpp 3 | * 4 | * Created on: Nov 27, 2013 5 | * Author: cfyz 6 | */ 7 | 8 | #include "Common.hpp" 9 | 10 | void TestBasicOutput() 11 | { 12 | terminal_set("window.title='Omni: basic output'"); 13 | terminal_clear(); 14 | terminal_color("white"); 15 | 16 | // Wide color range 17 | int n = terminal_printf(2, 1, "[color=orange]1.[/color] Wide color range: ").width; 18 | const char long_word[] = "antidisestablishmentarianism."; 19 | const size_t long_word_length = sizeof(long_word)-1; 20 | for (size_t i = 0; i < long_word_length; i++) 21 | { 22 | float factor = float(i)/long_word_length; 23 | int red = (1.0f - factor) * 255; 24 | int green = factor * 255; 25 | terminal_color(color_from_argb(255, red, green, 0)); 26 | terminal_put(2+n+i, 1, long_word[i]); 27 | } 28 | terminal_color("white"); 29 | 30 | terminal_print(2, 3, "[color=orange]2.[/color] Backgrounds: [color=black][bkcolor=gray] grey [/bkcolor] [bkcolor=red] red "); 31 | 32 | terminal_print(2, 5, L"[color=orange]3.[/color] Unicode support: Кириллица Ελληνικά α=β²±2°"); 33 | 34 | terminal_print(2, 7, L"[color=orange]4.[/color] Tile composition: a + [color=red]/[/color] = a[+][color=red]/[/color], a vs. a[+][color=red]¨[/color]"); 35 | 36 | terminal_printf(2, 9, "[color=orange]5.[/color] Box drawing symbols:"); 37 | 38 | terminal_print 39 | ( 40 | 5, 11, 41 | L" ┌────────┐ \n" 42 | L" │!......s└─┐\n" 43 | L"┌──┘........s.│\n" 44 | L"│............>│\n" 45 | L"│...........┌─┘\n" 46 | L"│<.@..┌─────┘ \n" 47 | L"└─────┘ \n" 48 | ); 49 | 50 | terminal_refresh(); 51 | for (int key=0; key!=TK_CLOSE && key!=TK_ESCAPE; key=terminal_read()); 52 | } 53 | -------------------------------------------------------------------------------- /Terminal/Include/Python/setup.py: -------------------------------------------------------------------------------- 1 | import sys, os, re 2 | from setuptools import setup 3 | 4 | def get_binaries(): 5 | files = [f for f in os.listdir('bearlibterminal') if 'BearLibTerminal.' in f] 6 | if not files: 7 | raise RuntimeError('No library binary in the package') 8 | return files 9 | 10 | def get_version(): 11 | top_line = open('CHANGELOG.md').readline() 12 | return re.findall('^\#+\s+([\w\.]+)\s+.*$', top_line)[0] 13 | 14 | setup( 15 | name='bearlibterminal', 16 | version=get_version(), 17 | description='BearLibTerminal is a pseudoterminal window library', 18 | long_description=open('PACKAGE.rst', 'r').read(), 19 | url='http://foo.wyrd.name/en:bearlibterminal', 20 | author='Alexander Malinin', 21 | author_email='cfyzium@gmail.com', 22 | license='MIT', 23 | packages=['bearlibterminal'], 24 | zip_safe=False, 25 | package_data={'bearlibterminal': get_binaries()}, 26 | keywords='roguelike, terminal, ascii, tiles, unicode', 27 | platforms='Windows, Linux, Mac OS X', 28 | classifiers=[ 29 | 'Development Status :: 4 - Beta', 30 | 'Environment :: Win32 (MS Windows)', 31 | 'Environment :: X11 Applications', 32 | 'Environment :: MacOS X :: Cocoa', 33 | 'Intended Audience :: Developers', 34 | 'License :: OSI Approved :: MIT License', 35 | 'Natural Language :: English', 36 | 'Operating System :: Microsoft :: Windows', 37 | 'Operating System :: POSIX :: Linux', 38 | 'Operating System :: MacOS :: MacOS X', 39 | 'Programming Language :: Python :: 2', 40 | 'Programming Language :: Python :: 3', 41 | 'Topic :: Games/Entertainment', 42 | 'Topic :: Multimedia :: Graphics', 43 | 'Topic :: Software Development :: Libraries' 44 | ] 45 | ) 46 | -------------------------------------------------------------------------------- /Terminal/Source/BitmapTileset.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2016 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BITMAPTILESET_HPP_ 24 | #define BITMAPTILESET_HPP_ 25 | 26 | #include "Tileset.hpp" 27 | #include 28 | #include 29 | 30 | namespace BearLibTerminal 31 | { 32 | class BitmapTileset: public Tileset 33 | { 34 | public: 35 | BitmapTileset(char32_t offset, std::vector data, OptionGroup& options); 36 | Size GetBoundingBoxSize(); 37 | 38 | private: 39 | Size m_bounding_box_size; 40 | }; 41 | } 42 | 43 | #endif /* BITMAPTILESET_HPP_ */ 44 | -------------------------------------------------------------------------------- /Terminal/Include/Python/PACKAGE.rst: -------------------------------------------------------------------------------- 1 | .. contents:: 2 | :backlinks: top 3 | 4 | ======= 5 | About 6 | ======= 7 | BearLibTerminal is a library that creates a terminal-like window facilitating 8 | flexible textual output and uncomplicated input processing. 9 | 10 | A lot of roguelike games intentionally use asketic textual or pseudographic visual style. 11 | However, native output via the command line interface ususally have a few annoying 12 | shortcomings like low speed or palette and font restrictions. Using an extended 13 | character set (several languages at once or complicated pseudographics) may also be tricky. 14 | BearLibTerminal solves that by providing it's own window with a grid of character cells 15 | and simple yet powerful API for configuration and textual output. 16 | 17 | Online documentation: http://foo.wyrd.name/en:bearlibterminal:reference 18 | 19 | Source code and issue tracker: https://bitbucket.org/cfyzium/bearlibterminal 20 | 21 | Discussion forum: http://forums.roguetemple.com/index.php?topic=3896.0 22 | 23 | ============== 24 | Installation 25 | ============== 26 | Use pip: 27 | 28 | .. code-block:: 29 | 30 | pip install bearlibterminal 31 | 32 | This will install everything necessary to use BearLibTerminal from Python, both the wrapper and the library binary. 33 | 34 | .. code-block:: python 35 | 36 | from bearlibterminal import terminal 37 | terminal.open() 38 | terminal.printf(2, 1, "Hello, world!") 39 | terminal.refresh() 40 | while terminal.read() != terminal.TK_CLOSE: 41 | pass 42 | terminal.close() 43 | 44 | ============== 45 | Requirements 46 | ============== 47 | Python 2.7+ or 3.x 48 | 49 | ========= 50 | License 51 | ========= 52 | BearLibTerminal is distributed under the MIT license. 53 | -------------------------------------------------------------------------------- /Terminal/Source/Keystroke.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2015 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BEARLIBTERMINAL_KEYSTROKE_HPP 24 | #define BEARLIBTERMINAL_KEYSTROKE_HPP 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace BearLibTerminal 31 | { 32 | struct Event 33 | { 34 | int code; 35 | std::unordered_map properties; // Slot -> value map 36 | 37 | Event(int code); 38 | Event(int code, std::unordered_map properties); 39 | int& operator[](int index); 40 | }; 41 | } 42 | 43 | #endif // BEARLIBTERMINAL_KEYSTROKE_HPP 44 | -------------------------------------------------------------------------------- /Terminal/Source/Palette.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BEARLIBTERMINAL_PALETTE_HPP 24 | #define BEARLIBTERMINAL_PALETTE_HPP 25 | 26 | #include 27 | #include 28 | #include "Color.hpp" 29 | 30 | namespace BearLibTerminal 31 | { 32 | class Palette 33 | { 34 | public: 35 | Palette(); 36 | Color Get(std::wstring name); 37 | void Set(std::wstring name, Color base); 38 | static Palette Instance; 39 | 40 | protected: 41 | std::unordered_map m_colors; 42 | }; 43 | } 44 | 45 | #endif // BEARLIBTERMINAL_PALETTE_HPP 46 | -------------------------------------------------------------------------------- /Terminal/Source/OptionGroup.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2015 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef OPTIONGROUP_HPP_ 24 | #define OPTIONGROUP_HPP_ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace BearLibTerminal 31 | { 32 | struct OptionGroup 33 | { 34 | std::wstring name; 35 | std::map attributes; 36 | }; 37 | 38 | std::list ParseOptions2(const std::wstring& s, bool semicolon_comments = false); 39 | 40 | std::wstring read_until3(const wchar_t*& p, const std::wstring& until); 41 | } 42 | 43 | #endif /* OPTIONGROUP_HPP_ */ 44 | -------------------------------------------------------------------------------- /Terminal/Source/DynamicTileset.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2016 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef DYNAMICTILESET_HPP_ 24 | #define DYNAMICTILESET_HPP_ 25 | 26 | #include "Tileset.hpp" 27 | 28 | namespace BearLibTerminal 29 | { 30 | class DynamicTileset: public Tileset 31 | { 32 | public: 33 | DynamicTileset(char32_t offset, OptionGroup& options); 34 | DynamicTileset(char32_t offset, Size tile_size); 35 | Size GetBoundingBoxSize(); 36 | bool Provides(char32_t code); 37 | std::shared_ptr Get(char32_t code); 38 | private: 39 | Size m_tile_size; 40 | }; 41 | } 42 | 43 | #endif /* DYNAMICTILESET_HPP_ */ 44 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | BearLibTerminal 2 | --------------- 3 | Copyright (C) 2013-2014 Cfyz -- cfyzium@gmail.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | 23 | Libraries used by BearLibTerminal 24 | --------------------------------- 25 | 1. FreeType2 -- http://www.freetype.org/freetype2/ 26 | Modified source code is in ./Terminal/Dependencies/FreeType 27 | Licensed under the FreeType License 28 | 29 | 2. PicoPNG -- http://lodev.org/lodepng/ 30 | Source code is in ./Terminal/Dependencies/PicoPNG 31 | Licensed under the zlib license 32 | 33 | 3. NanoJPEG C++ port -- http://h4ck3r.net/2009/12/02/mini-jpeg-decoder/ 34 | Source code is in ./Terminal/Dependencies/NanoJPEG 35 | Licensed under the custom permissive license (see source) 36 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/base/ftxf86.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftxf86.c */ 4 | /* */ 5 | /* FreeType utility file for X11 support (body). */ 6 | /* */ 7 | /* Copyright 2002, 2003, 2004 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #include 20 | #include FT_XFREE86_H 21 | #include FT_INTERNAL_OBJECTS_H 22 | #include FT_SERVICE_XFREE86_NAME_H 23 | 24 | 25 | /* documentation is in ftxf86.h */ 26 | 27 | FT_EXPORT_DEF( const char* ) 28 | FT_Get_X11_Font_Format( FT_Face face ) 29 | { 30 | const char* result = NULL; 31 | 32 | 33 | if ( face ) 34 | FT_FACE_FIND_SERVICE( face, result, XF86_NAME ); 35 | 36 | return result; 37 | } 38 | 39 | 40 | /* END */ 41 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/base/ftbase.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftbase.c */ 4 | /* */ 5 | /* Single object library component (body only). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #include 20 | 21 | #define FT_MAKE_OPTION_SINGLE_OBJECT 22 | 23 | #include "ftpic.c" 24 | #include "basepic.c" 25 | #include "ftadvanc.c" 26 | #include "ftcalc.c" 27 | #include "ftdbgmem.c" 28 | #include "ftgloadr.c" 29 | #include "ftobjs.c" 30 | #include "ftoutln.c" 31 | #include "ftrfork.c" 32 | #include "ftsnames.c" 33 | #include "ftstream.c" 34 | #include "fttrigon.c" 35 | #include "ftutil.c" 36 | 37 | #ifdef FT_MACINTOSH 38 | #include "ftmac.c" 39 | #endif 40 | 41 | /* END */ 42 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/autofit.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* autofit.c */ 4 | /* */ 5 | /* Auto-fitter module (body). */ 6 | /* */ 7 | /* Copyright 2003-2007, 2011 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #define FT_MAKE_OPTION_SINGLE_OBJECT 20 | #include 21 | #include "afpic.c" 22 | #include "afangles.c" 23 | #include "afglobal.c" 24 | #include "afhints.c" 25 | 26 | #include "afdummy.c" 27 | #include "aflatin.c" 28 | #ifdef FT_OPTION_AUTOFIT2 29 | #include "aflatin2.c" 30 | #endif 31 | #include "afcjk.c" 32 | #include "afindic.c" 33 | 34 | #include "afloader.c" 35 | #include "afmodule.c" 36 | 37 | #ifdef AF_CONFIG_OPTION_USE_WARPER 38 | #include "afwarp.c" 39 | #endif 40 | 41 | /* END */ 42 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/sfnt.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* sfnt.c */ 4 | /* */ 5 | /* Single object library component. */ 6 | /* */ 7 | /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #define FT_MAKE_OPTION_SINGLE_OBJECT 20 | 21 | #include 22 | #include "sfntpic.c" 23 | #include "ttload.c" 24 | #include "ttmtx.c" 25 | #include "ttcmap.c" 26 | #include "ttkern.c" 27 | #include "sfobjs.c" 28 | #include "sfdriver.c" 29 | 30 | #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS 31 | #include "ttsbit.c" 32 | #endif 33 | 34 | #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES 35 | #include "ttpost.c" 36 | #endif 37 | 38 | #ifdef TT_CONFIG_OPTION_BDF 39 | #include "ttbdf.c" 40 | #endif 41 | 42 | /* END */ 43 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/afdummy.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* afdummy.h */ 4 | /* */ 5 | /* Auto-fitter dummy routines to be used if no hinting should be */ 6 | /* performed (specification). */ 7 | /* */ 8 | /* Copyright 2003-2005, 2011 by */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | 20 | #ifndef __AFDUMMY_H__ 21 | #define __AFDUMMY_H__ 22 | 23 | #include "aftypes.h" 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | /* A dummy script metrics class used when no hinting should 29 | * be performed. This is the default for non-latin glyphs! 30 | */ 31 | 32 | AF_DECLARE_SCRIPT_CLASS( af_dummy_script_class ) 33 | 34 | /* */ 35 | 36 | FT_END_HEADER 37 | 38 | 39 | #endif /* __AFDUMMY_H__ */ 40 | 41 | 42 | /* END */ 43 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/truetype/truetype.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* truetype.c */ 4 | /* */ 5 | /* FreeType TrueType driver component (body only). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2004, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #define FT_MAKE_OPTION_SINGLE_OBJECT 20 | 21 | #include 22 | #include "ttpic.c" 23 | #include "ttdriver.c" /* driver interface */ 24 | #include "ttpload.c" /* tables loader */ 25 | #include "ttgload.c" /* glyph loader */ 26 | #include "ttobjs.c" /* object manager */ 27 | 28 | #ifdef TT_USE_BYTECODE_INTERPRETER 29 | #include "ttinterp.c" 30 | #endif 31 | 32 | #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT 33 | #include "ttgxvar.c" /* gx distortable font */ 34 | #endif 35 | 36 | 37 | /* END */ 38 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/ttbdf.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttbdf.h */ 4 | /* */ 5 | /* TrueType and OpenType embedded BDF properties (specification). */ 6 | /* */ 7 | /* Copyright 2005 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __TTBDF_H__ 20 | #define __TTBDF_H__ 21 | 22 | 23 | #include 24 | #include "ttload.h" 25 | #include FT_BDF_H 26 | 27 | 28 | FT_BEGIN_HEADER 29 | 30 | 31 | FT_LOCAL( void ) 32 | tt_face_free_bdf_props( TT_Face face ); 33 | 34 | 35 | FT_LOCAL( FT_Error ) 36 | tt_face_find_bdf_prop( TT_Face face, 37 | const char* property_name, 38 | BDF_PropertyRec *aprop ); 39 | 40 | 41 | FT_END_HEADER 42 | 43 | #endif /* __TTBDF_H__ */ 44 | 45 | 46 | /* END */ 47 | -------------------------------------------------------------------------------- /Samples/Omni/Source/Sprites.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Sprites.cpp 3 | * 4 | * Created on: Nov 27, 2013 5 | * Author: cfyz 6 | */ 7 | 8 | #include "Common.hpp" 9 | 10 | void TestSprites() 11 | { 12 | terminal_set("window.title='Omni: sprites'"); 13 | 14 | terminal_set("U+E000: ../Media/Background.jpg"); 15 | terminal_set("U+E001: ../Media/EasternDragon.png, resize=128x128, resize-filter=nearest"); 16 | terminal_set("U+E002: ../Media/FiveElements.bmp, resize=128x128, resize-filter=bilinear"); 17 | 18 | color_t c[] = 19 | { 20 | color_from_argb(128, 192, 64, 64), 21 | color_from_argb(128, 64, 192, 64), 22 | color_from_argb(128, 64, 64, 192), 23 | color_from_argb(128, 192, 192, 64) 24 | }; 25 | terminal_setf("U+E003: %#p, raw-size=2x2, resize=128x128, resize-filter=bicubic", &c); 26 | 27 | terminal_clear(); 28 | 29 | terminal_color("black"); 30 | terminal_print(2, 1, "[color=black]This primarily serves as a quick test of image format support"); 31 | terminal_print(2, 3, "1. Background is loaded from a JPEG file"); 32 | terminal_print(2, 5, "2. Dragon sprite is loaded from a PNG file\n image is upscaled 2x with nearest neighbourhood filter"); 33 | terminal_print(2, 8, "3. Five elements diagram is loaded from BMP file\n image is downscaled with bilinear filer"); 34 | terminal_print(2, 11, "4. Color gradient is loaded from 2x2 in-memory buffer\n image is upscaled 64x with bicubic filter"); 35 | 36 | terminal_color("white"); 37 | terminal_put(0, 0, 0xE000); // Background 38 | terminal_put(5, 14, 0xE001); // Dragon 39 | terminal_put(5+18*1, 14, 0xE002); // FiveElements 40 | terminal_put(5+18*2, 14, 0xE003); // Gradient 41 | 42 | terminal_refresh(); 43 | 44 | while (true) 45 | { 46 | int key = terminal_read(); 47 | 48 | if (key == TK_CLOSE || key == TK_ESCAPE) 49 | { 50 | break; 51 | } 52 | } 53 | 54 | terminal_set("U+E000: none; U+E001: none; U+E002: none; U+E003: none"); 55 | } 56 | -------------------------------------------------------------------------------- /Terminal/Source/BOM.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2015 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BOM_HPP_ 24 | #define BOM_HPP_ 25 | 26 | #include 27 | #include 28 | 29 | namespace BearLibTerminal 30 | { 31 | enum class BOM 32 | { 33 | None = -1, 34 | UTF8 = 0, 35 | UTF16LE, 36 | UTF16BE, 37 | UTF32LE, 38 | UTF32BE, 39 | ASCII_Flag = 0x10, 40 | ASCII_UTF8 = ASCII_Flag, 41 | ASCII_UTF16LE, 42 | ASCII_UTF16BE, 43 | ASCII_UTF32LE, 44 | ASCII_UTF32BE 45 | }; 46 | 47 | BOM DetectBOM(std::istream& stream); 48 | 49 | void PlaceBOM(std::ostream& stream, BOM bom); 50 | 51 | size_t GetBOMSize(BOM bom); 52 | 53 | std::wostream& operator<<(std::wostream& stream, BOM bom); 54 | } 55 | 56 | #endif /* BOM_HPP_ */ 57 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Include/freetype/internal/services/svtteng.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svtteng.h */ 4 | /* */ 5 | /* The FreeType TrueType engine query service (specification). */ 6 | /* */ 7 | /* Copyright 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVTTENG_H__ 20 | #define __SVTTENG_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | #include FT_MODULE_H 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | 29 | /* 30 | * SFNT table loading service. 31 | */ 32 | 33 | #define FT_SERVICE_ID_TRUETYPE_ENGINE "truetype-engine" 34 | 35 | /* 36 | * Used to implement FT_Get_TrueType_Engine_Type 37 | */ 38 | 39 | FT_DEFINE_SERVICE( TrueTypeEngine ) 40 | { 41 | FT_TrueTypeEngineType engine_type; 42 | }; 43 | 44 | /* */ 45 | 46 | 47 | FT_END_HEADER 48 | 49 | 50 | #endif /* __SVTTENG_H__ */ 51 | 52 | 53 | /* END */ 54 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/smooth/ftsmooth.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftsmooth.h */ 4 | /* */ 5 | /* Anti-aliasing renderer interface (specification). */ 6 | /* */ 7 | /* Copyright 1996-2001 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __FTSMOOTH_H__ 20 | #define __FTSMOOTH_H__ 21 | 22 | 23 | #include 24 | #include FT_RENDER_H 25 | 26 | 27 | FT_BEGIN_HEADER 28 | 29 | 30 | #ifndef FT_CONFIG_OPTION_NO_STD_RASTER 31 | FT_DECLARE_RENDERER( ft_std_renderer_class ) 32 | #endif 33 | 34 | #ifndef FT_CONFIG_OPTION_NO_SMOOTH_RASTER 35 | FT_DECLARE_RENDERER( ft_smooth_renderer_class ) 36 | 37 | FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class ) 38 | 39 | FT_DECLARE_RENDERER( ft_smooth_lcd_v_renderer_class ) 40 | #endif 41 | 42 | 43 | 44 | FT_END_HEADER 45 | 46 | #endif /* __FTSMOOTH_H__ */ 47 | 48 | 49 | /* END */ 50 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Include/freetype/internal/services/svwinfnt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svwinfnt.h */ 4 | /* */ 5 | /* The FreeType Windows FNT/FONT service (specification). */ 6 | /* */ 7 | /* Copyright 2003 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVWINFNT_H__ 20 | #define __SVWINFNT_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | #include FT_WINFONTS_H 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | 29 | #define FT_SERVICE_ID_WINFNT "winfonts" 30 | 31 | typedef FT_Error 32 | (*FT_WinFnt_GetHeaderFunc)( FT_Face face, 33 | FT_WinFNT_HeaderRec *aheader ); 34 | 35 | 36 | FT_DEFINE_SERVICE( WinFnt ) 37 | { 38 | FT_WinFnt_GetHeaderFunc get_header; 39 | }; 40 | 41 | /* */ 42 | 43 | 44 | FT_END_HEADER 45 | 46 | 47 | #endif /* __SVWINFNT_H__ */ 48 | 49 | 50 | /* END */ 51 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/ttpost.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttpost.h */ 4 | /* */ 5 | /* Postcript name table processing for TrueType and OpenType fonts */ 6 | /* (specification). */ 7 | /* */ 8 | /* Copyright 1996-2001, 2002 by */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | 20 | #ifndef __TTPOST_H__ 21 | #define __TTPOST_H__ 22 | 23 | 24 | #include 25 | #include FT_CONFIG_CONFIG_H 26 | #include FT_INTERNAL_TRUETYPE_TYPES_H 27 | 28 | 29 | FT_BEGIN_HEADER 30 | 31 | 32 | FT_LOCAL( FT_Error ) 33 | tt_face_get_ps_name( TT_Face face, 34 | FT_UInt idx, 35 | FT_String** PSname ); 36 | 37 | FT_LOCAL( void ) 38 | tt_face_free_ps_names( TT_Face face ); 39 | 40 | 41 | FT_END_HEADER 42 | 43 | #endif /* __TTPOST_H__ */ 44 | 45 | 46 | /* END */ 47 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/raster/ftrend1.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftrend1.h */ 4 | /* */ 5 | /* The FreeType glyph rasterizer interface (specification). */ 6 | /* */ 7 | /* Copyright 1996-2001 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __FTREND1_H__ 20 | #define __FTREND1_H__ 21 | 22 | 23 | #include 24 | #include FT_RENDER_H 25 | 26 | 27 | FT_BEGIN_HEADER 28 | 29 | 30 | FT_DECLARE_RENDERER( ft_raster1_renderer_class ) 31 | 32 | /* this renderer is _NOT_ part of the default modules, you'll need */ 33 | /* to register it by hand in your application. It should only be */ 34 | /* used for backwards-compatibility with FT 1.x anyway. */ 35 | /* */ 36 | FT_DECLARE_RENDERER( ft_raster5_renderer_class ) 37 | 38 | 39 | FT_END_HEADER 40 | 41 | #endif /* __FTREND1_H__ */ 42 | 43 | 44 | /* END */ 45 | -------------------------------------------------------------------------------- /Samples/Omni/Source/AutoGenerated.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * AutoGeneratedTileset.cpp 3 | * 4 | * Created on: Nov 27, 2013 5 | * Author: cfyz 6 | */ 7 | 8 | #include "Common.hpp" 9 | 10 | void TestAutoGenerated() 11 | { 12 | terminal_set("window.title='Omni: auto-generated tileset'"); 13 | 14 | int hoffset = 40; 15 | int cell_width = terminal_state(TK_CELL_WIDTH); 16 | int cell_height = terminal_state(TK_CELL_HEIGHT); 17 | auto setup_cellsize = [&]{terminal_setf("window.cellsize=%dx%d", cell_width, cell_height);}; 18 | 19 | while (true) 20 | { 21 | terminal_clear(); 22 | terminal_color("white"); 23 | 24 | terminal_printf(2, 1, "[color=orange]Cell size:[/color] %dx%d", cell_width, cell_height); 25 | terminal_printf(2, 3, "[color=orange]TIP:[/color] Use arrow keys\nto change cell size"); 26 | 27 | for (int j=0; j<16; j++) 28 | { 29 | terminal_printf(hoffset+6+j*2, 1, "[color=orange]%X", j); 30 | } 31 | for (int code=0x2500, y=0; code<=0x259F; code++) 32 | { 33 | if (code%16 == 0) terminal_printf(hoffset, 2+y*1, " [color=orange]%04X", code); 34 | terminal_put(hoffset+6+(code%16)*2, 2+y*1, code); 35 | if ((code+1)%16 == 0) y += 1; 36 | } 37 | 38 | terminal_print 39 | ( 40 | 2, 6, 41 | L"┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐\n" 42 | L"│Z││A││ ││W││A││R││U││D││O│\n" 43 | L"└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘\n" 44 | ); 45 | 46 | terminal_refresh(); 47 | 48 | int key = terminal_read(); 49 | 50 | if (key == TK_CLOSE || key == TK_ESCAPE) 51 | { 52 | break; 53 | } 54 | else if (key == TK_LEFT && cell_width > 4) 55 | { 56 | cell_width -= 1; 57 | setup_cellsize(); 58 | } 59 | else if (key == TK_RIGHT && cell_width < 24) 60 | { 61 | cell_width += 1; 62 | setup_cellsize(); 63 | } 64 | else if (key == TK_DOWN && cell_height < 24) 65 | { 66 | cell_height += 1; 67 | setup_cellsize(); 68 | } 69 | else if (key == TK_UP && cell_height > 4) 70 | { 71 | cell_height -= 1; 72 | setup_cellsize(); 73 | } 74 | } 75 | 76 | terminal_set("window.cellsize=auto"); 77 | } 78 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Include/freetype/internal/services/svkern.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svkern.h */ 4 | /* */ 5 | /* The FreeType Kerning service (specification). */ 6 | /* */ 7 | /* Copyright 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVKERN_H__ 20 | #define __SVKERN_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | #include FT_TRUETYPE_TABLES_H 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | #define FT_SERVICE_ID_KERNING "kerning" 29 | 30 | 31 | typedef FT_Error 32 | (*FT_Kerning_TrackGetFunc)( FT_Face face, 33 | FT_Fixed point_size, 34 | FT_Int degree, 35 | FT_Fixed* akerning ); 36 | 37 | FT_DEFINE_SERVICE( Kerning ) 38 | { 39 | FT_Kerning_TrackGetFunc get_track; 40 | }; 41 | 42 | /* */ 43 | 44 | 45 | FT_END_HEADER 46 | 47 | 48 | #endif /* __SVKERN_H__ */ 49 | 50 | 51 | /* END */ 52 | -------------------------------------------------------------------------------- /Terminal/Source/OpenGL.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "OpenGL.hpp" 24 | #include "Log.hpp" 25 | #include 26 | #include 27 | 28 | namespace BearLibTerminal 29 | { 30 | int g_max_texture_size = 256; 31 | bool g_has_texture_npot = false; 32 | int g_texture_filter = GL_LINEAR; 33 | 34 | void ProbeOpenGL() 35 | { 36 | GLint size; 37 | glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size); 38 | g_max_texture_size = size; 39 | LOG(Info, "OpenGL: maximum texture size is " << size << "x" << size); 40 | 41 | std::string extensions = (const char*)glGetString(GL_EXTENSIONS); 42 | std::transform(extensions.begin(), extensions.end(), extensions.begin(), ::tolower); 43 | g_has_texture_npot = extensions.find("gl_arb_texture_non_power_of_two") != std::string::npos; 44 | LOG(Info, "OpenGL: GPU " << (g_has_texture_npot? "supports": "does not support") << " NPOTD textures"); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Samples/Omni/Source/DefaultFont.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * DefaultFont.cpp 3 | * 4 | * Created on: Nov 27, 2013 5 | * Author: cfyz 6 | */ 7 | 8 | #include "Common.hpp" 9 | #include "WindowsGlyphList4.hpp" 10 | 11 | void TestDefaultFont() 12 | { 13 | terminal_set("window: size=80x25, cellsize=auto, title='Omni: WGL4'; font=default"); 14 | 15 | const int hoffset = 40; 16 | int current_range = 0; 17 | 18 | while (true) 19 | { 20 | terminal_clear(); 21 | terminal_wprint(2, 1, L"[color=white]Select unicode character range:"); 22 | 23 | for (int i=0; i 0) 59 | { 60 | current_range -= 1; 61 | } 62 | else if (key == TK_DOWN && current_range < g_wgl4_ranges.size()-1) 63 | { 64 | current_range += 1; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Samples/Omni/Source/Pick.cpp: -------------------------------------------------------------------------------- 1 | #include "Common.hpp" 2 | #include 3 | #include 4 | 5 | void TestPick() 6 | { 7 | terminal_set("window.title='Omni: examining cell contents'"); 8 | terminal_set("input.filter={keyboard, mouse}"); // Enable mouse events. 9 | 10 | terminal_clear(); 11 | terminal_color("white"); 12 | terminal_printf(2, 1, "Move mouse over characters:"); 13 | 14 | terminal_bkcolor("darkest gray"); 15 | terminal_clear_area(2, 3, 76, 19); 16 | terminal_bkcolor("none"); 17 | 18 | const char* colors[] = {"red", "orange", "yellow", "green", "cyan", "light blue", "violet"}; 19 | int combining[] = {0x02C6, 0x02C9, 0x02DC, 0x2014, 0x2044, 0x2017, 0x203E}; 20 | 21 | std::srand(std::time(nullptr)); 22 | for (int i = 0; i < 100; i++) 23 | { 24 | bool combined = (rand() % 5 == 0); 25 | int n = combined? (rand() % 2) + 2: 1; 26 | int x = 2 + (rand() % 76); 27 | int y = 3 + (rand() % 19); 28 | 29 | terminal_color(colors[rand() % 7]); 30 | terminal_put(x, y, 'a' + (rand() % 26)); 31 | 32 | terminal_composition(TK_ON); 33 | for (int i = 1; i < n; i++) 34 | { 35 | terminal_color(colors[rand() % 7]); 36 | terminal_put(x, y, combining[rand() % 7]); 37 | } 38 | terminal_composition(TK_OFF); 39 | } 40 | 41 | terminal_color("white"); 42 | 43 | while (true) 44 | { 45 | int x = terminal_state(TK_MOUSE_X); 46 | int y = terminal_state(TK_MOUSE_Y); 47 | 48 | terminal_clear_area(2, 23, 76, 1); 49 | if (x >= 2 && x < 78 && y >= 3 && y < 22) 50 | { 51 | int n = 0; 52 | 53 | do 54 | { 55 | int code = terminal_pick(x, y, n); 56 | if (code == 0) break; 57 | 58 | color_t color = terminal_pick_color(x, y, n); 59 | terminal_printf(2+n*2, 23, L"[color=%d]%lc", color, (wchar_t)code); 60 | 61 | n += 1; 62 | } 63 | while (true); 64 | 65 | if (n == 0) 66 | { 67 | terminal_printf(2, 23, "Empty cell"); 68 | } 69 | } 70 | 71 | terminal_refresh(); 72 | 73 | int key = terminal_read(); 74 | 75 | if (key == TK_CLOSE || key == TK_ESCAPE) 76 | { 77 | break; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/smooth/rules.mk: -------------------------------------------------------------------------------- 1 | # 2 | # FreeType 2 smooth renderer module build rules 3 | # 4 | 5 | 6 | # Copyright 1996-2000, 2001, 2003, 2011 by 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. 8 | # 9 | # This file is part of the FreeType project, and may only be used, modified, 10 | # and distributed under the terms of the FreeType project license, 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 12 | # indicate that you have read the license and understand and accept it 13 | # fully. 14 | 15 | 16 | # smooth driver directory 17 | # 18 | SMOOTH_DIR := $(SRC_DIR)/smooth 19 | 20 | # compilation flags for the driver 21 | # 22 | SMOOTH_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SMOOTH_DIR)) 23 | 24 | 25 | # smooth driver sources (i.e., C files) 26 | # 27 | SMOOTH_DRV_SRC := $(SMOOTH_DIR)/ftgrays.c \ 28 | $(SMOOTH_DIR)/ftsmooth.c \ 29 | $(SMOOTH_DIR)/ftspic.c 30 | 31 | 32 | # smooth driver headers 33 | # 34 | SMOOTH_DRV_H := $(SMOOTH_DRV_SRC:%c=%h) \ 35 | $(SMOOTH_DIR)/ftsmerrs.h 36 | 37 | 38 | # smooth driver object(s) 39 | # 40 | # SMOOTH_DRV_OBJ_M is used during `multi' builds. 41 | # SMOOTH_DRV_OBJ_S is used during `single' builds. 42 | # 43 | SMOOTH_DRV_OBJ_M := $(SMOOTH_DRV_SRC:$(SMOOTH_DIR)/%.c=$(OBJ_DIR)/%.$O) 44 | SMOOTH_DRV_OBJ_S := $(OBJ_DIR)/smooth.$O 45 | 46 | # smooth driver source file for single build 47 | # 48 | SMOOTH_DRV_SRC_S := $(SMOOTH_DIR)/smooth.c 49 | 50 | 51 | # smooth driver - single object 52 | # 53 | $(SMOOTH_DRV_OBJ_S): $(SMOOTH_DRV_SRC_S) $(SMOOTH_DRV_SRC) \ 54 | $(FREETYPE_H) $(SMOOTH_DRV_H) 55 | $(SMOOTH_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(SMOOTH_DRV_SRC_S)) 56 | 57 | 58 | # smooth driver - multiple objects 59 | # 60 | $(OBJ_DIR)/%.$O: $(SMOOTH_DIR)/%.c $(FREETYPE_H) $(SMOOTH_DRV_H) 61 | $(SMOOTH_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) 62 | 63 | 64 | # update main driver object lists 65 | # 66 | DRV_OBJS_S += $(SMOOTH_DRV_OBJ_S) 67 | DRV_OBJS_M += $(SMOOTH_DRV_OBJ_M) 68 | 69 | 70 | # EOF 71 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/raster/rules.mk: -------------------------------------------------------------------------------- 1 | # 2 | # FreeType 2 renderer module build rules 3 | # 4 | 5 | 6 | # Copyright 1996-2000, 2001, 2003, 2008, 2009, 2011 by 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. 8 | # 9 | # This file is part of the FreeType project, and may only be used, modified, 10 | # and distributed under the terms of the FreeType project license, 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 12 | # indicate that you have read the license and understand and accept it 13 | # fully. 14 | 15 | 16 | # raster driver directory 17 | # 18 | RASTER_DIR := $(SRC_DIR)/raster 19 | 20 | # compilation flags for the driver 21 | # 22 | RASTER_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(RASTER_DIR)) 23 | 24 | 25 | # raster driver sources (i.e., C files) 26 | # 27 | RASTER_DRV_SRC := $(RASTER_DIR)/ftraster.c \ 28 | $(RASTER_DIR)/ftrend1.c \ 29 | $(RASTER_DIR)/rastpic.c 30 | 31 | 32 | # raster driver headers 33 | # 34 | RASTER_DRV_H := $(RASTER_DRV_SRC:%.c=%.h) \ 35 | $(RASTER_DIR)/rasterrs.h 36 | 37 | 38 | # raster driver object(s) 39 | # 40 | # RASTER_DRV_OBJ_M is used during `multi' builds. 41 | # RASTER_DRV_OBJ_S is used during `single' builds. 42 | # 43 | RASTER_DRV_OBJ_M := $(RASTER_DRV_SRC:$(RASTER_DIR)/%.c=$(OBJ_DIR)/%.$O) 44 | RASTER_DRV_OBJ_S := $(OBJ_DIR)/raster.$O 45 | 46 | # raster driver source file for single build 47 | # 48 | RASTER_DRV_SRC_S := $(RASTER_DIR)/raster.c 49 | 50 | 51 | # raster driver - single object 52 | # 53 | $(RASTER_DRV_OBJ_S): $(RASTER_DRV_SRC_S) $(RASTER_DRV_SRC) \ 54 | $(FREETYPE_H) $(RASTER_DRV_H) 55 | $(RASTER_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(RASTER_DRV_SRC_S)) 56 | 57 | 58 | # raster driver - multiple objects 59 | # 60 | $(OBJ_DIR)/%.$O: $(RASTER_DIR)/%.c $(FREETYPE_H) $(RASTER_DRV_H) 61 | $(RASTER_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) 62 | 63 | 64 | # update main driver object lists 65 | # 66 | DRV_OBJS_S += $(RASTER_DRV_OBJ_S) 67 | DRV_OBJS_M += $(RASTER_DRV_OBJ_M) 68 | 69 | 70 | # EOF 71 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/base/ftwinfnt.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftwinfnt.c */ 4 | /* */ 5 | /* FreeType API for accessing Windows FNT specific info (body). */ 6 | /* */ 7 | /* Copyright 2003, 2004 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #include 20 | #include FT_WINFONTS_H 21 | #include FT_INTERNAL_OBJECTS_H 22 | #include FT_SERVICE_WINFNT_H 23 | 24 | 25 | /* documentation is in ftwinfnt.h */ 26 | 27 | FT_EXPORT_DEF( FT_Error ) 28 | FT_Get_WinFNT_Header( FT_Face face, 29 | FT_WinFNT_HeaderRec *header ) 30 | { 31 | FT_Service_WinFnt service; 32 | FT_Error error; 33 | 34 | 35 | error = FT_Err_Invalid_Argument; 36 | 37 | if ( face != NULL ) 38 | { 39 | FT_FACE_LOOKUP_SERVICE( face, service, WINFNT ); 40 | 41 | if ( service != NULL ) 42 | { 43 | error = service->get_header( face, header ); 44 | } 45 | } 46 | 47 | return error; 48 | } 49 | 50 | 51 | /* END */ 52 | -------------------------------------------------------------------------------- /Terminal/Source/OpenGL.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2016 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BEARLIBTERMINAL_OPENGL_HPP 24 | #define BEARLIBTERMINAL_OPENGL_HPP 25 | 26 | // Windows requires inclusion of windows.h since gl.h depends on it 27 | // Also, gl.h in windows is a bit outdated 28 | #if defined(_WIN32) 29 | #define WIN32_LEAN_AND_MEAN 30 | #include 31 | #include 32 | #undef LoadBitmap // There is a function with same name in WinAPI 33 | // OpenGL 1.2+ 34 | #define GL_BGRA 0x80E1 35 | #elif defined(__linux) 36 | #include 37 | #elif defined(__APPLE__) 38 | #include 39 | #endif 40 | 41 | namespace BearLibTerminal 42 | { 43 | // OpenGL states/caps 44 | // This breaks strict opengl context ownership 45 | extern int g_max_texture_size; 46 | extern bool g_has_texture_npot; 47 | extern int g_texture_filter; 48 | 49 | void ProbeOpenGL(); 50 | } 51 | 52 | #endif // BEARLIBTERMINAL_OPENGL_HPP 53 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/truetype/rules.mk: -------------------------------------------------------------------------------- 1 | # 2 | # FreeType 2 TrueType driver configuration rules 3 | # 4 | 5 | 6 | # Copyright 1996-2000, 2001, 2003, 2004, 2011 by 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. 8 | # 9 | # This file is part of the FreeType project, and may only be used, modified, 10 | # and distributed under the terms of the FreeType project license, 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 12 | # indicate that you have read the license and understand and accept it 13 | # fully. 14 | 15 | 16 | # TrueType driver directory 17 | # 18 | TT_DIR := $(SRC_DIR)/truetype 19 | 20 | 21 | # compilation flags for the driver 22 | # 23 | TT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(TT_DIR)) 24 | 25 | 26 | # TrueType driver sources (i.e., C files) 27 | # 28 | TT_DRV_SRC := $(TT_DIR)/ttdriver.c \ 29 | $(TT_DIR)/ttgload.c \ 30 | $(TT_DIR)/ttgxvar.c \ 31 | $(TT_DIR)/ttinterp.c \ 32 | $(TT_DIR)/ttobjs.c \ 33 | $(TT_DIR)/ttpic.c \ 34 | $(TT_DIR)/ttpload.c 35 | 36 | # TrueType driver headers 37 | # 38 | TT_DRV_H := $(TT_DRV_SRC:%.c=%.h) \ 39 | $(TT_DIR)/tterrors.h 40 | 41 | 42 | # TrueType driver object(s) 43 | # 44 | # TT_DRV_OBJ_M is used during `multi' builds 45 | # TT_DRV_OBJ_S is used during `single' builds 46 | # 47 | TT_DRV_OBJ_M := $(TT_DRV_SRC:$(TT_DIR)/%.c=$(OBJ_DIR)/%.$O) 48 | TT_DRV_OBJ_S := $(OBJ_DIR)/truetype.$O 49 | 50 | # TrueType driver source file for single build 51 | # 52 | TT_DRV_SRC_S := $(TT_DIR)/truetype.c 53 | 54 | 55 | # TrueType driver - single object 56 | # 57 | $(TT_DRV_OBJ_S): $(TT_DRV_SRC_S) $(TT_DRV_SRC) $(FREETYPE_H) $(TT_DRV_H) 58 | $(TT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(TT_DRV_SRC_S)) 59 | 60 | 61 | # driver - multiple objects 62 | # 63 | $(OBJ_DIR)/%.$O: $(TT_DIR)/%.c $(FREETYPE_H) $(TT_DRV_H) 64 | $(TT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) 65 | 66 | 67 | # update main driver object lists 68 | # 69 | DRV_OBJS_S += $(TT_DRV_OBJ_S) 70 | DRV_OBJS_M += $(TT_DRV_OBJ_M) 71 | 72 | 73 | # EOF 74 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/sferrors.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* sferrors.h */ 4 | /* */ 5 | /* SFNT error codes (specification only). */ 6 | /* */ 7 | /* Copyright 2001, 2004, 2012 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | /*************************************************************************/ 20 | /* */ 21 | /* This file is used to define the SFNT error enumeration constants. */ 22 | /* */ 23 | /*************************************************************************/ 24 | 25 | #ifndef __SFERRORS_H__ 26 | #define __SFERRORS_H__ 27 | 28 | #include FT_MODULE_ERRORS_H 29 | 30 | #undef __FTERRORS_H__ 31 | 32 | #undef FT_ERR_PREFIX 33 | #define FT_ERR_PREFIX SFNT_Err_ 34 | #define FT_ERR_BASE FT_Mod_Err_SFNT 35 | 36 | #define FT_KEEP_ERR_PREFIX 37 | 38 | #include FT_ERRORS_H 39 | 40 | #endif /* __SFERRORS_H__ */ 41 | 42 | /* END */ 43 | -------------------------------------------------------------------------------- /Terminal/Source/Options.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2016 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "Options.hpp" 24 | #include "Keystroke.hpp" 25 | #include "OpenGL.hpp" 26 | 27 | namespace BearLibTerminal 28 | { 29 | Options::Options(): 30 | terminal_encoding_affects_put(true), 31 | window_size(0, 0), 32 | window_cellsize(0, 0), 33 | window_title(L"BearLibTerminal"), 34 | window_icon(L":default_icon"), 35 | window_resizeable(false), 36 | window_minimum_size(1, 1), 37 | window_fullscreen(false), 38 | output_postformatting(true), 39 | output_vsync(true), 40 | output_tab_width(4), 41 | output_texture_filter(GL_LINEAR), 42 | input_precise_mouse(false), 43 | input_cursor_symbol('_'), 44 | input_cursor_blink_rate(500), 45 | input_mouse_cursor(true), 46 | input_alt_functions(true), 47 | log_filename(L"bearlibterminal.log"), // FIXME: dependency failure 48 | log_level(Log::Level::Error), 49 | log_mode(Log::Mode::Truncate) 50 | { } 51 | } 52 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/raster/ftraster.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftraster.h */ 4 | /* */ 5 | /* The FreeType glyph rasterizer (specification). */ 6 | /* */ 7 | /* Copyright 1996-2001 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used */ 11 | /* modified and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __FTRASTER_H__ 20 | #define __FTRASTER_H__ 21 | 22 | 23 | #include 24 | #include FT_CONFIG_CONFIG_H 25 | #include FT_IMAGE_H 26 | 27 | 28 | FT_BEGIN_HEADER 29 | 30 | 31 | /*************************************************************************/ 32 | /* */ 33 | /* Uncomment the following line if you are using ftraster.c as a */ 34 | /* standalone module, fully independent of FreeType. */ 35 | /* */ 36 | /* #define _STANDALONE_ */ 37 | 38 | FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_standard_raster; 39 | 40 | 41 | FT_END_HEADER 42 | 43 | #endif /* __FTRASTER_H__ */ 44 | 45 | 46 | /* END */ 47 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/aferrors.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* aferrors.h */ 4 | /* */ 5 | /* Autofitter error codes (specification only). */ 6 | /* */ 7 | /* Copyright 2005, 2012 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | /*************************************************************************/ 20 | /* */ 21 | /* This file is used to define the Autofitter error enumeration */ 22 | /* constants. */ 23 | /* */ 24 | /*************************************************************************/ 25 | 26 | #ifndef __AFERRORS_H__ 27 | #define __AFERRORS_H__ 28 | 29 | #include FT_MODULE_ERRORS_H 30 | 31 | #undef __FTERRORS_H__ 32 | 33 | #undef FT_ERR_PREFIX 34 | #define FT_ERR_PREFIX AF_Err_ 35 | #define FT_ERR_BASE FT_Mod_Err_Autofit 36 | 37 | #include FT_ERRORS_H 38 | 39 | #endif /* __AFERRORS_H__ */ 40 | 41 | /* END */ 42 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/ttkern.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttkern.h */ 4 | /* */ 5 | /* Load the basic TrueType kerning table. This doesn't handle */ 6 | /* kerning data within the GPOS table at the moment. */ 7 | /* */ 8 | /* Copyright 1996-2001, 2002, 2005, 2007 by */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | 20 | #ifndef __TTKERN_H__ 21 | #define __TTKERN_H__ 22 | 23 | 24 | #include 25 | #include FT_INTERNAL_STREAM_H 26 | #include FT_INTERNAL_TRUETYPE_TYPES_H 27 | 28 | 29 | FT_BEGIN_HEADER 30 | 31 | 32 | FT_LOCAL( FT_Error ) 33 | tt_face_load_kern( TT_Face face, 34 | FT_Stream stream ); 35 | 36 | FT_LOCAL( void ) 37 | tt_face_done_kern( TT_Face face ); 38 | 39 | FT_LOCAL( FT_Int ) 40 | tt_face_get_kerning( TT_Face face, 41 | FT_UInt left_glyph, 42 | FT_UInt right_glyph ); 43 | 44 | #define TT_FACE_HAS_KERNING( face ) ( (face)->kern_avail_bits != 0 ) 45 | 46 | 47 | FT_END_HEADER 48 | 49 | #endif /* __TTKERN_H__ */ 50 | 51 | 52 | /* END */ 53 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/truetype/tterrors.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* tterrors.h */ 4 | /* */ 5 | /* TrueType error codes (specification only). */ 6 | /* */ 7 | /* Copyright 2001, 2012 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | /*************************************************************************/ 20 | /* */ 21 | /* This file is used to define the TrueType error enumeration */ 22 | /* constants. */ 23 | /* */ 24 | /*************************************************************************/ 25 | 26 | #ifndef __TTERRORS_H__ 27 | #define __TTERRORS_H__ 28 | 29 | #include FT_MODULE_ERRORS_H 30 | 31 | #undef __FTERRORS_H__ 32 | 33 | #undef FT_ERR_PREFIX 34 | #define FT_ERR_PREFIX TT_Err_ 35 | #define FT_ERR_BASE FT_Mod_Err_TrueType 36 | 37 | #include FT_ERRORS_H 38 | 39 | #endif /* __TTERRORS_H__ */ 40 | 41 | /* END */ 42 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/raster/rasterrs.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* rasterrs.h */ 4 | /* */ 5 | /* monochrome renderer error codes (specification only). */ 6 | /* */ 7 | /* Copyright 2001, 2012 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | /*************************************************************************/ 20 | /* */ 21 | /* This file is used to define the monochrome renderer error enumeration */ 22 | /* constants. */ 23 | /* */ 24 | /*************************************************************************/ 25 | 26 | #ifndef __RASTERRS_H__ 27 | #define __RASTERRS_H__ 28 | 29 | #include FT_MODULE_ERRORS_H 30 | 31 | #undef __FTERRORS_H__ 32 | 33 | #undef FT_ERR_PREFIX 34 | #define FT_ERR_PREFIX Raster_Err_ 35 | #define FT_ERR_BASE FT_Mod_Err_Raster 36 | 37 | #include FT_ERRORS_H 38 | 39 | #endif /* __RASTERRS_H__ */ 40 | 41 | 42 | /* END */ 43 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/smooth/ftsmerrs.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftsmerrs.h */ 4 | /* */ 5 | /* smooth renderer error codes (specification only). */ 6 | /* */ 7 | /* Copyright 2001, 2012 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | /*************************************************************************/ 20 | /* */ 21 | /* This file is used to define the smooth renderer error enumeration */ 22 | /* constants. */ 23 | /* */ 24 | /*************************************************************************/ 25 | 26 | #ifndef __FTSMERRS_H__ 27 | #define __FTSMERRS_H__ 28 | 29 | #include FT_MODULE_ERRORS_H 30 | 31 | #undef __FTERRORS_H__ 32 | 33 | #undef FT_ERR_PREFIX 34 | #define FT_ERR_PREFIX Smooth_Err_ 35 | #define FT_ERR_BASE FT_Mod_Err_Smooth 36 | 37 | #include FT_ERRORS_H 38 | 39 | #endif /* __FTSMERRS_H__ */ 40 | 41 | 42 | /* END */ 43 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/ttcmapc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttcmapc.h */ 4 | /* */ 5 | /* TT CMAP classes definitions (specification only). */ 6 | /* */ 7 | /* Copyright 2009 by */ 8 | /* Oran Agra and Mickey Gabel. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifdef TT_CONFIG_CMAP_FORMAT_0 20 | TTCMAPCITEM(tt_cmap0_class_rec) 21 | #endif 22 | 23 | #ifdef TT_CONFIG_CMAP_FORMAT_2 24 | TTCMAPCITEM(tt_cmap2_class_rec) 25 | #endif 26 | 27 | #ifdef TT_CONFIG_CMAP_FORMAT_4 28 | TTCMAPCITEM(tt_cmap4_class_rec) 29 | #endif 30 | 31 | #ifdef TT_CONFIG_CMAP_FORMAT_6 32 | TTCMAPCITEM(tt_cmap6_class_rec) 33 | #endif 34 | 35 | #ifdef TT_CONFIG_CMAP_FORMAT_8 36 | TTCMAPCITEM(tt_cmap8_class_rec) 37 | #endif 38 | 39 | #ifdef TT_CONFIG_CMAP_FORMAT_10 40 | TTCMAPCITEM(tt_cmap10_class_rec) 41 | #endif 42 | 43 | #ifdef TT_CONFIG_CMAP_FORMAT_12 44 | TTCMAPCITEM(tt_cmap12_class_rec) 45 | #endif 46 | 47 | #ifdef TT_CONFIG_CMAP_FORMAT_13 48 | TTCMAPCITEM(tt_cmap13_class_rec) 49 | #endif 50 | 51 | #ifdef TT_CONFIG_CMAP_FORMAT_14 52 | TTCMAPCITEM(tt_cmap14_class_rec) 53 | #endif 54 | 55 | /* END */ 56 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/base/ftpic.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftpic.c */ 4 | /* */ 5 | /* The FreeType position independent code services (body). */ 6 | /* */ 7 | /* Copyright 2009 by */ 8 | /* Oran Agra and Mickey Gabel. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #include 20 | #include FT_FREETYPE_H 21 | #include FT_INTERNAL_OBJECTS_H 22 | #include "basepic.h" 23 | 24 | #ifdef FT_CONFIG_OPTION_PIC 25 | 26 | /* documentation is in ftpic.h */ 27 | 28 | FT_BASE_DEF( FT_Error ) 29 | ft_pic_container_init( FT_Library library ) 30 | { 31 | FT_PIC_Container* pic_container = &library->pic_container; 32 | FT_Error error = FT_Err_Ok; 33 | 34 | FT_MEM_SET( pic_container, 0, sizeof ( *pic_container ) ); 35 | 36 | error = ft_base_pic_init( library ); 37 | if ( error ) 38 | return error; 39 | 40 | return FT_Err_Ok; 41 | } 42 | 43 | 44 | /* Destroy the contents of the container. */ 45 | FT_BASE_DEF( void ) 46 | ft_pic_container_destroy( FT_Library library ) 47 | { 48 | ft_base_pic_free( library ); 49 | } 50 | 51 | #endif /* FT_CONFIG_OPTION_PIC */ 52 | 53 | 54 | /* END */ 55 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Include/freetype/internal/services/svotval.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svotval.h */ 4 | /* */ 5 | /* The FreeType OpenType validation service (specification). */ 6 | /* */ 7 | /* Copyright 2004, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVOTVAL_H__ 20 | #define __SVOTVAL_H__ 21 | 22 | #include FT_OPENTYPE_VALIDATE_H 23 | #include FT_INTERNAL_VALIDATE_H 24 | 25 | FT_BEGIN_HEADER 26 | 27 | 28 | #define FT_SERVICE_ID_OPENTYPE_VALIDATE "opentype-validate" 29 | 30 | 31 | typedef FT_Error 32 | (*otv_validate_func)( FT_Face volatile face, 33 | FT_UInt ot_flags, 34 | FT_Bytes *base, 35 | FT_Bytes *gdef, 36 | FT_Bytes *gpos, 37 | FT_Bytes *gsub, 38 | FT_Bytes *jstf ); 39 | 40 | 41 | FT_DEFINE_SERVICE( OTvalidate ) 42 | { 43 | otv_validate_func validate; 44 | }; 45 | 46 | /* */ 47 | 48 | 49 | FT_END_HEADER 50 | 51 | 52 | #endif /* __SVOTVAL_H__ */ 53 | 54 | 55 | /* END */ 56 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/sfobjs.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* sfobjs.h */ 4 | /* */ 5 | /* SFNT object management (specification). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2002 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SFOBJS_H__ 20 | #define __SFOBJS_H__ 21 | 22 | 23 | #include 24 | #include FT_INTERNAL_SFNT_H 25 | #include FT_INTERNAL_OBJECTS_H 26 | 27 | 28 | FT_BEGIN_HEADER 29 | 30 | 31 | FT_LOCAL( FT_Error ) 32 | sfnt_init_face( FT_Stream stream, 33 | TT_Face face, 34 | FT_Int face_index, 35 | FT_Int num_params, 36 | FT_Parameter* params ); 37 | 38 | FT_LOCAL( FT_Error ) 39 | sfnt_load_face( FT_Stream stream, 40 | TT_Face face, 41 | FT_Int face_index, 42 | FT_Int num_params, 43 | FT_Parameter* params ); 44 | 45 | FT_LOCAL( void ) 46 | sfnt_done_face( TT_Face face ); 47 | 48 | 49 | FT_END_HEADER 50 | 51 | #endif /* __SFDRIVER_H__ */ 52 | 53 | 54 | /* END */ 55 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/ttmtx.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttmtx.h */ 4 | /* */ 5 | /* Load the metrics tables common to TTF and OTF fonts (specification). */ 6 | /* */ 7 | /* Copyright 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __TTMTX_H__ 20 | #define __TTMTX_H__ 21 | 22 | 23 | #include 24 | #include FT_INTERNAL_STREAM_H 25 | #include FT_INTERNAL_TRUETYPE_TYPES_H 26 | 27 | 28 | FT_BEGIN_HEADER 29 | 30 | 31 | FT_LOCAL( FT_Error ) 32 | tt_face_load_hhea( TT_Face face, 33 | FT_Stream stream, 34 | FT_Bool vertical ); 35 | 36 | 37 | FT_LOCAL( FT_Error ) 38 | tt_face_load_hmtx( TT_Face face, 39 | FT_Stream stream, 40 | FT_Bool vertical ); 41 | 42 | 43 | FT_LOCAL( FT_Error ) 44 | tt_face_get_metrics( TT_Face face, 45 | FT_Bool vertical, 46 | FT_UInt gindex, 47 | FT_Short* abearing, 48 | FT_UShort* aadvance ); 49 | 50 | FT_END_HEADER 51 | 52 | #endif /* __TTMTX_H__ */ 53 | 54 | 55 | /* END */ 56 | -------------------------------------------------------------------------------- /Terminal/Source/Texture.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2016 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BEARLIBTERMINAL_TEXTURE_HPP 24 | #define BEARLIBTERMINAL_TEXTURE_HPP 25 | 26 | #include 27 | #include "Bitmap.hpp" 28 | #include "Size.hpp" 29 | 30 | namespace BearLibTerminal 31 | { 32 | class Texture 33 | { 34 | public: 35 | typedef std::uint32_t handle_t; 36 | 37 | Texture(); 38 | Texture(Texture&& texture); 39 | Texture(const Bitmap& bitmap); 40 | virtual ~Texture(); 41 | Texture& operator=(Texture&& texture); 42 | void Dispose(); 43 | void Bind(); 44 | void Update(const Bitmap& bitmap); 45 | void Update(Rectangle area, const Bitmap& bitmap); 46 | void ApplyTextureFilter(); 47 | Bitmap Download(); 48 | Size GetSize() const; 49 | handle_t GetHandle() const; 50 | static void Enable(); 51 | static void Disable(); 52 | static void Unbind(); 53 | static handle_t BoundId(); 54 | 55 | protected: 56 | handle_t m_handle; 57 | Size m_size; 58 | static uint32_t m_currently_bound_handle; 59 | }; 60 | } 61 | 62 | #endif // BEARLIBTERMINAL_TEXTURE_HPP 63 | -------------------------------------------------------------------------------- /Terminal/Source/TrueTypeTileset.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2017 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef TRUETYPETILESET_HPP_ 24 | #define TRUETYPETILESET_HPP_ 25 | 26 | #include 27 | #include 28 | #include "Tileset.hpp" 29 | #include "Encoding.hpp" 30 | 31 | #include 32 | #include FT_FREETYPE_H 33 | 34 | namespace BearLibTerminal 35 | { 36 | class TrueTypeTileset: public Tileset 37 | { 38 | public: 39 | TrueTypeTileset(char32_t offset, std::vector data, OptionGroup& options); 40 | bool Provides(char32_t code); 41 | std::shared_ptr Get(char32_t code); 42 | Size GetBoundingBoxSize(); 43 | 44 | private: 45 | FT_UInt GetGlyphIndex(char32_t code); 46 | Size m_tile_size; 47 | TileAlignment m_alignment; 48 | std::unique_ptr m_codepage; 49 | std::vector m_font_data; 50 | std::shared_ptr m_font_library; 51 | std::shared_ptr m_font_face; 52 | FT_Render_Mode m_render_mode; 53 | FT_Int32 m_hinting; 54 | bool m_monospace; 55 | bool m_use_box_drawing; 56 | bool m_use_block_elements; 57 | }; 58 | } 59 | 60 | #endif /* TRUETYPETILESET_HPP_ */ 61 | -------------------------------------------------------------------------------- /Samples/Omni/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | if (UNIX AND NOT APPLE) 4 | set(LINUX TRUE) 5 | endif() 6 | 7 | project(SampleOmni) 8 | 9 | set(CMAKE_SKIP_RPATH TRUE) 10 | 11 | # Detect system bitness 12 | math(EXPR BITNESS "8*${CMAKE_SIZEOF_VOID_P}") 13 | 14 | set(SOURCE_FILES ./Source/Main.cpp 15 | ./Source/Common.cpp 16 | ./Source/WindowsGlyphList4.cpp 17 | ./Source/BasicOutput.cpp 18 | ./Source/DefaultFont.cpp 19 | ./Source/Tilesets.cpp 20 | ./Source/Sprites.cpp 21 | ./Source/ManualCellsize.cpp 22 | ./Source/AutoGenerated.cpp 23 | ./Source/MultipleFonts.cpp 24 | ./Source/TextAlignment.cpp 25 | ./Source/FormattedLog.cpp 26 | ./Source/Layers.cpp 27 | ./Source/ExtendedBasics.cpp 28 | ./Source/ExtendedInterlayer.cpp 29 | ./Source/ExtendedSmoothScroll.cpp 30 | ./Source/DynamicSprites.cpp 31 | ./Source/Speed.cpp 32 | ./Source/Keyboard.cpp 33 | ./Source/Mouse.cpp 34 | ./Source/TextInput.cpp 35 | ./Source/InputFiltering.cpp 36 | ./Source/WindowResize.cpp 37 | ./Source/Pick.cpp) 38 | 39 | set(HEADER_FILES ./Source/Common.hpp) 40 | 41 | add_executable(SampleOmni ${SOURCE_FILES} ${HEADER_FILES}) 42 | 43 | set_target_properties(SampleOmni PROPERTIES 44 | CXX_STANDARD 14 45 | CXX_STANDARD_REQUIRED TRUE) 46 | target_include_directories(SampleOmni PRIVATE ${CMAKE_SOURCE_DIR}/Terminal/Include/C) 47 | 48 | target_link_libraries(SampleOmni BearLibTerminal) 49 | 50 | if(MINGW) 51 | target_link_libraries(SampleOmni -static) 52 | elseif(LINUX) 53 | target_link_libraries(SampleOmni -Wl,-R. -static-libgcc -static-libstdc++) 54 | endif() 55 | 56 | if(WIN32) 57 | set_target_properties(SampleOmni PROPERTIES WIN32_EXECUTABLE TRUE) 58 | target_link_libraries(SampleOmni winmm.lib) 59 | endif() 60 | 61 | set(OUTPUT_DIR ${CMAKE_SOURCE_DIR}/Output/${CMAKE_SYSTEM_NAME}${BITNESS}) 62 | set_target_properties(SampleOmni PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) 63 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Include/freetype/internal/services/svxf86nm.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svxf86nm.h */ 4 | /* */ 5 | /* The FreeType XFree86 services (specification only). */ 6 | /* */ 7 | /* Copyright 2003 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVXF86NM_H__ 20 | #define __SVXF86NM_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | 24 | 25 | FT_BEGIN_HEADER 26 | 27 | 28 | /* 29 | * A trivial service used to return the name of a face's font driver, 30 | * according to the XFree86 nomenclature. Note that the service data 31 | * is a simple constant string pointer. 32 | */ 33 | 34 | #define FT_SERVICE_ID_XF86_NAME "xf86-driver-name" 35 | 36 | #define FT_XF86_FORMAT_TRUETYPE "TrueType" 37 | #define FT_XF86_FORMAT_TYPE_1 "Type 1" 38 | #define FT_XF86_FORMAT_BDF "BDF" 39 | #define FT_XF86_FORMAT_PCF "PCF" 40 | #define FT_XF86_FORMAT_TYPE_42 "Type 42" 41 | #define FT_XF86_FORMAT_CID "CID Type 1" 42 | #define FT_XF86_FORMAT_CFF "CFF" 43 | #define FT_XF86_FORMAT_PFR "PFR" 44 | #define FT_XF86_FORMAT_WINFNT "Windows FNT" 45 | 46 | /* */ 47 | 48 | 49 | FT_END_HEADER 50 | 51 | 52 | #endif /* __SVXF86NM_H__ */ 53 | 54 | 55 | /* END */ 56 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/truetype/ttgload.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttgload.h */ 4 | /* */ 5 | /* TrueType Glyph Loader (specification). */ 6 | /* */ 7 | /* Copyright 1996-2006, 2008, 2011 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __TTGLOAD_H__ 20 | #define __TTGLOAD_H__ 21 | 22 | 23 | #include 24 | #include "ttobjs.h" 25 | 26 | #ifdef TT_USE_BYTECODE_INTERPRETER 27 | #include "ttinterp.h" 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | FT_LOCAL( void ) 35 | TT_Init_Glyph_Loading( TT_Face face ); 36 | 37 | FT_LOCAL( void ) 38 | TT_Get_HMetrics( TT_Face face, 39 | FT_UInt idx, 40 | FT_Short* lsb, 41 | FT_UShort* aw ); 42 | 43 | FT_LOCAL( void ) 44 | TT_Get_VMetrics( TT_Face face, 45 | FT_UInt idx, 46 | FT_Short* tsb, 47 | FT_UShort* ah ); 48 | 49 | FT_LOCAL( FT_Error ) 50 | TT_Load_Glyph( TT_Size size, 51 | TT_GlyphSlot glyph, 52 | FT_UInt glyph_index, 53 | FT_Int32 load_flags ); 54 | 55 | 56 | FT_END_HEADER 57 | 58 | #endif /* __TTGLOAD_H__ */ 59 | 60 | 61 | /* END */ 62 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Include/ft2build.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ft2build.h */ 4 | /* */ 5 | /* FreeType 2 build and setup macros. */ 6 | /* (Generic version) */ 7 | /* */ 8 | /* Copyright 1996-2001, 2006 by */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | 20 | /*************************************************************************/ 21 | /* */ 22 | /* This file corresponds to the default `ft2build.h' file for */ 23 | /* FreeType 2. It uses the `freetype' include root. */ 24 | /* */ 25 | /* Note that specific platforms might use a different configuration. */ 26 | /* See builds/unix/ft2unix.h for an example. */ 27 | /* */ 28 | /*************************************************************************/ 29 | 30 | 31 | #ifndef __FT2_BUILD_GENERIC_H__ 32 | #define __FT2_BUILD_GENERIC_H__ 33 | 34 | #include 35 | 36 | #endif /* __FT2_BUILD_GENERIC_H__ */ 37 | 38 | 39 | /* END */ 40 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/base/ftgasp.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftgasp.c */ 4 | /* */ 5 | /* Access of TrueType's `gasp' table (body). */ 6 | /* */ 7 | /* Copyright 2007 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #include 20 | #include FT_GASP_H 21 | #include FT_INTERNAL_TRUETYPE_TYPES_H 22 | 23 | 24 | FT_EXPORT_DEF( FT_Int ) 25 | FT_Get_Gasp( FT_Face face, 26 | FT_UInt ppem ) 27 | { 28 | FT_Int result = FT_GASP_NO_TABLE; 29 | 30 | 31 | if ( face && FT_IS_SFNT( face ) ) 32 | { 33 | TT_Face ttface = (TT_Face)face; 34 | 35 | 36 | if ( ttface->gasp.numRanges > 0 ) 37 | { 38 | TT_GaspRange range = ttface->gasp.gaspRanges; 39 | TT_GaspRange range_end = range + ttface->gasp.numRanges; 40 | 41 | 42 | while ( ppem > range->maxPPEM ) 43 | { 44 | range++; 45 | if ( range >= range_end ) 46 | goto Exit; 47 | } 48 | 49 | result = range->gaspFlag; 50 | 51 | /* ensure that we don't have spurious bits */ 52 | if ( ttface->gasp.version == 0 ) 53 | result &= 3; 54 | } 55 | } 56 | Exit: 57 | return result; 58 | } 59 | 60 | 61 | /* END */ 62 | -------------------------------------------------------------------------------- /Terminal/Source/Point.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BEARLIBTERMINAL_POINT_HPP 24 | #define BEARLIBTERMINAL_POINT_HPP 25 | 26 | namespace BearLibTerminal 27 | { 28 | template struct BasicPoint 29 | { 30 | typedef T value_type; 31 | 32 | T x, y; 33 | 34 | BasicPoint(): 35 | x(0), 36 | y(0) 37 | { } 38 | 39 | BasicPoint(T x, T y): 40 | x(x), 41 | y(y) 42 | { } 43 | 44 | BasicPoint(const BasicPoint& from): 45 | x(from.x), 46 | y(from.y) 47 | { } 48 | 49 | inline bool operator==(BasicPoint other) const 50 | { 51 | return x == other.x && y == other.y; 52 | } 53 | 54 | inline bool operator!= (BasicPoint other) const 55 | { 56 | return x != other.x || y != other.y; 57 | } 58 | 59 | inline BasicPoint operator+(BasicPoint other) 60 | { 61 | return BasicPoint(x+other.x, y+other.y); 62 | } 63 | 64 | inline BasicPoint operator-(BasicPoint other) 65 | { 66 | return BasicPoint(x-other.x, y-other.y); 67 | } 68 | }; 69 | 70 | typedef BasicPoint Point; 71 | 72 | typedef BasicPoint PointF; 73 | } 74 | 75 | #endif // BEARLIBTERMINAL_POINT_HPP 76 | -------------------------------------------------------------------------------- /Terminal/Source/Stage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2014 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "Stage.hpp" 24 | #include "BearLibTerminal.h" 25 | 26 | namespace BearLibTerminal 27 | { 28 | Leaf::Leaf(): 29 | dx(0), 30 | dy(0), 31 | code(0), 32 | flags(0), 33 | reserved(0) 34 | { } 35 | 36 | Layer::Layer(Size size): 37 | cells(size.Area()) 38 | { } 39 | 40 | void Stage::Resize(Size new_size) 41 | { 42 | size = new_size; 43 | 44 | // Background: reset to transparent 45 | backbuffer.background = std::vector(size.Area()); 46 | 47 | if (backbuffer.layers.empty()) 48 | { 49 | // Scene must have at least one layer 50 | backbuffer.layers.emplace_back(size); 51 | } 52 | else 53 | { 54 | // Must preserve number of layers since who knows what layer is currently selected 55 | for (auto& i: backbuffer.layers) i = Layer(size); 56 | } 57 | 58 | // TODO: unnecessary? 59 | if (frontbuffer.background.size() != backbuffer.background.size()) 60 | { 61 | frontbuffer = backbuffer; 62 | } 63 | } 64 | 65 | State::State(): 66 | color(255, 255, 255, 255), 67 | bkcolor(), 68 | composition(TK_OFF), 69 | layer(0), 70 | font_offset(0) 71 | { } 72 | } 73 | -------------------------------------------------------------------------------- /Terminal/Source/Options.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2016 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef OPTIONS_HPP_ 24 | #define OPTIONS_HPP_ 25 | 26 | #include "Size.hpp" 27 | #include "Log.hpp" 28 | #include 29 | #include 30 | 31 | namespace BearLibTerminal 32 | { 33 | struct Options 34 | { 35 | // Terminal 36 | std::wstring terminal_encoding; 37 | bool terminal_encoding_affects_put; 38 | 39 | // Window 40 | Size window_size; 41 | Size window_cellsize; 42 | Size window_client_size; 43 | std::wstring window_title; 44 | std::wstring window_icon; 45 | bool window_resizeable; 46 | Size window_minimum_size; 47 | bool window_fullscreen; 48 | 49 | // Output 50 | bool output_postformatting; 51 | bool output_vsync; 52 | int output_tab_width; 53 | int output_texture_filter; 54 | 55 | // Input 56 | bool input_precise_mouse; 57 | char32_t input_cursor_symbol; 58 | int input_cursor_blink_rate; 59 | bool input_mouse_cursor; 60 | std::set input_filter; 61 | bool input_alt_functions; 62 | 63 | // Log 64 | std::wstring log_filename; 65 | Log::Level log_level; 66 | Log::Mode log_mode; 67 | 68 | Options(); 69 | }; 70 | } 71 | 72 | #endif /* OPTIONS_HPP_ */ 73 | -------------------------------------------------------------------------------- /Terminal/Source/CocoaWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2016 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BEARLIBTERMINAL_COCOAWINDOW_H 24 | #define BEARLIBTERMINAL_COCOAWINDOW_H 25 | 26 | #if defined(__APPLE__) 27 | 28 | #include "Window.hpp" 29 | 30 | namespace BearLibTerminal 31 | { 32 | class CocoaWindow: public Window 33 | { 34 | public: 35 | struct Impl; 36 | CocoaWindow(EventHandler handler); 37 | ~CocoaWindow(); 38 | Size GetActualSize(); 39 | void SetTitle(const std::wstring& title); 40 | void SetIcon(const std::wstring& filename); 41 | void SetClientSize(const Size& size); 42 | void Show(); 43 | void Hide(); 44 | void SwapBuffers(); 45 | void SetVSync(bool enabled); 46 | void SetSizeHints(Size increment, Size minimum_size); 47 | void SetResizeable(bool resizeable); 48 | void SetFullscreen(bool fullscreen); 49 | void SetCursorVisibility(bool visible); 50 | int PumpEvents(); 51 | protected: 52 | void Construct(); 53 | void Destroy(); 54 | void ApplySizeHints(); 55 | std::unique_ptr m_impl; 56 | }; 57 | 58 | std::wstring GetCocoaPasteboardString(); 59 | } 60 | 61 | #endif // __APPLE__ 62 | 63 | #endif // BEARLIBTERMINAL_COCOAWINDOW_H -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/afwarp.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* afwarp.h */ 4 | /* */ 5 | /* Auto-fitter warping algorithm (specification). */ 6 | /* */ 7 | /* Copyright 2006, 2007 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __AFWARP_H__ 20 | #define __AFWARP_H__ 21 | 22 | #include "afhints.h" 23 | 24 | FT_BEGIN_HEADER 25 | 26 | #define AF_WARPER_SCALE 27 | 28 | #define AF_WARPER_FLOOR( x ) ( (x) & ~63 ) 29 | #define AF_WARPER_CEIL( x ) AF_WARPER_FLOOR( (x) + 63 ) 30 | 31 | 32 | typedef FT_Int32 AF_WarpScore; 33 | 34 | typedef struct AF_WarperRec_ 35 | { 36 | FT_Pos x1, x2; 37 | FT_Pos t1, t2; 38 | FT_Pos x1min, x1max; 39 | FT_Pos x2min, x2max; 40 | FT_Pos w0, wmin, wmax; 41 | 42 | FT_Fixed best_scale; 43 | FT_Pos best_delta; 44 | AF_WarpScore best_score; 45 | AF_WarpScore best_distort; 46 | 47 | } AF_WarperRec, *AF_Warper; 48 | 49 | 50 | FT_LOCAL( void ) 51 | af_warper_compute( AF_Warper warper, 52 | AF_GlyphHints hints, 53 | AF_Dimension dim, 54 | FT_Fixed *a_scale, 55 | FT_Fixed *a_delta ); 56 | 57 | 58 | FT_END_HEADER 59 | 60 | 61 | #endif /* __AFWARP_H__ */ 62 | 63 | 64 | /* END */ 65 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/raster/rastpic.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* rastpic.h */ 4 | /* */ 5 | /* The FreeType position independent code services for raster module. */ 6 | /* */ 7 | /* Copyright 2009 by */ 8 | /* Oran Agra and Mickey Gabel. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __RASTPIC_H__ 20 | #define __RASTPIC_H__ 21 | 22 | 23 | FT_BEGIN_HEADER 24 | 25 | #include FT_INTERNAL_PIC_H 26 | 27 | #ifndef FT_CONFIG_OPTION_PIC 28 | #define FT_STANDARD_RASTER_GET ft_standard_raster 29 | 30 | #else /* FT_CONFIG_OPTION_PIC */ 31 | 32 | typedef struct RasterPIC_ 33 | { 34 | int ref_count; 35 | FT_Raster_Funcs ft_standard_raster; 36 | } RasterPIC; 37 | 38 | #define GET_PIC(lib) ((RasterPIC*)((lib)->pic_container.raster)) 39 | #define FT_STANDARD_RASTER_GET (GET_PIC(library)->ft_standard_raster) 40 | 41 | /* see rastpic.c for the implementation */ 42 | void 43 | ft_raster1_renderer_class_pic_free( FT_Library library ); 44 | 45 | void 46 | ft_raster5_renderer_class_pic_free( FT_Library library ); 47 | 48 | FT_Error 49 | ft_raster1_renderer_class_pic_init( FT_Library library ); 50 | 51 | FT_Error 52 | ft_raster5_renderer_class_pic_init( FT_Library library ); 53 | 54 | #endif /* FT_CONFIG_OPTION_PIC */ 55 | 56 | /* */ 57 | 58 | FT_END_HEADER 59 | 60 | #endif /* __RASTPIC_H__ */ 61 | 62 | 63 | /* END */ 64 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/sfnt/rules.mk: -------------------------------------------------------------------------------- 1 | # 2 | # FreeType 2 SFNT driver configuration rules 3 | # 4 | 5 | 6 | # Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2011 by 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. 8 | # 9 | # This file is part of the FreeType project, and may only be used, modified, 10 | # and distributed under the terms of the FreeType project license, 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 12 | # indicate that you have read the license and understand and accept it 13 | # fully. 14 | 15 | 16 | # SFNT driver directory 17 | # 18 | SFNT_DIR := $(SRC_DIR)/sfnt 19 | 20 | 21 | # compilation flags for the driver 22 | # 23 | SFNT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SFNT_DIR)) 24 | 25 | 26 | # SFNT driver sources (i.e., C files) 27 | # 28 | SFNT_DRV_SRC := $(SFNT_DIR)/ttload.c \ 29 | $(SFNT_DIR)/ttmtx.c \ 30 | $(SFNT_DIR)/ttcmap.c \ 31 | $(SFNT_DIR)/ttsbit.c \ 32 | $(SFNT_DIR)/ttpost.c \ 33 | $(SFNT_DIR)/ttkern.c \ 34 | $(SFNT_DIR)/ttbdf.c \ 35 | $(SFNT_DIR)/sfobjs.c \ 36 | $(SFNT_DIR)/sfdriver.c \ 37 | $(SFNT_DIR)/sfntpic.c 38 | 39 | # SFNT driver headers 40 | # 41 | # Note that ttsbit0.c gets #included by ttsbit.c. 42 | # 43 | SFNT_DRV_H := $(SFNT_DRV_SRC:%c=%h) \ 44 | $(SFNT_DIR)/sferrors.h \ 45 | $(SFNT_DIR)/ttsbit0.c 46 | 47 | 48 | # SFNT driver object(s) 49 | # 50 | # SFNT_DRV_OBJ_M is used during `multi' builds. 51 | # SFNT_DRV_OBJ_S is used during `single' builds. 52 | # 53 | SFNT_DRV_OBJ_M := $(SFNT_DRV_SRC:$(SFNT_DIR)/%.c=$(OBJ_DIR)/%.$O) 54 | SFNT_DRV_OBJ_S := $(OBJ_DIR)/sfnt.$O 55 | 56 | # SFNT driver source file for single build 57 | # 58 | SFNT_DRV_SRC_S := $(SFNT_DIR)/sfnt.c 59 | 60 | 61 | # SFNT driver - single object 62 | # 63 | $(SFNT_DRV_OBJ_S): $(SFNT_DRV_SRC_S) $(SFNT_DRV_SRC) \ 64 | $(FREETYPE_H) $(SFNT_DRV_H) 65 | $(SFNT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(SFNT_DRV_SRC_S)) 66 | 67 | 68 | # SFNT driver - multiple objects 69 | # 70 | $(OBJ_DIR)/%.$O: $(SFNT_DIR)/%.c $(FREETYPE_H) $(SFNT_DRV_H) 71 | $(SFNT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) 72 | 73 | 74 | # update main driver object lists 75 | # 76 | DRV_OBJS_S += $(SFNT_DRV_OBJ_S) 77 | DRV_OBJS_M += $(SFNT_DRV_OBJ_M) 78 | 79 | 80 | # EOF 81 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/afdummy.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* afdummy.c */ 4 | /* */ 5 | /* Auto-fitter dummy routines to be used if no hinting should be */ 6 | /* performed (body). */ 7 | /* */ 8 | /* Copyright 2003-2005, 2011 by */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | 20 | #include "afdummy.h" 21 | #include "afhints.h" 22 | #include "aferrors.h" 23 | 24 | 25 | static FT_Error 26 | af_dummy_hints_init( AF_GlyphHints hints, 27 | AF_ScriptMetrics metrics ) 28 | { 29 | af_glyph_hints_rescale( hints, 30 | metrics ); 31 | return AF_Err_Ok; 32 | } 33 | 34 | 35 | static FT_Error 36 | af_dummy_hints_apply( AF_GlyphHints hints, 37 | FT_Outline* outline ) 38 | { 39 | FT_UNUSED( hints ); 40 | FT_UNUSED( outline ); 41 | 42 | return AF_Err_Ok; 43 | } 44 | 45 | 46 | AF_DEFINE_SCRIPT_CLASS( af_dummy_script_class, 47 | AF_SCRIPT_NONE, 48 | NULL, 49 | 50 | sizeof ( AF_ScriptMetricsRec ), 51 | 52 | (AF_Script_InitMetricsFunc) NULL, 53 | (AF_Script_ScaleMetricsFunc)NULL, 54 | (AF_Script_DoneMetricsFunc) NULL, 55 | 56 | (AF_Script_InitHintsFunc) af_dummy_hints_init, 57 | (AF_Script_ApplyHintsFunc) af_dummy_hints_apply 58 | ) 59 | 60 | 61 | /* END */ 62 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/rules.mk: -------------------------------------------------------------------------------- 1 | # 2 | # FreeType 2 auto-fitter module configuration rules 3 | # 4 | 5 | 6 | # Copyright 2003, 2004, 2005, 2006, 2007, 2011 by 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. 8 | # 9 | # This file is part of the FreeType project, and may only be used, modified, 10 | # and distributed under the terms of the FreeType project license, 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you 12 | # indicate that you have read the license and understand and accept it 13 | # fully. 14 | 15 | 16 | # AUTOF driver directory 17 | # 18 | AUTOF_DIR := $(SRC_DIR)/autofit 19 | 20 | 21 | # compilation flags for the driver 22 | # 23 | AUTOF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(AUTOF_DIR)) 24 | 25 | 26 | # AUTOF driver sources (i.e., C files) 27 | # 28 | AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \ 29 | $(AUTOF_DIR)/afcjk.c \ 30 | $(AUTOF_DIR)/afdummy.c \ 31 | $(AUTOF_DIR)/afglobal.c \ 32 | $(AUTOF_DIR)/afhints.c \ 33 | $(AUTOF_DIR)/afindic.c \ 34 | $(AUTOF_DIR)/aflatin.c \ 35 | $(AUTOF_DIR)/afloader.c \ 36 | $(AUTOF_DIR)/afmodule.c \ 37 | $(AUTOF_DIR)/afpic.c \ 38 | $(AUTOF_DIR)/afwarp.c 39 | 40 | # AUTOF driver headers 41 | # 42 | AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \ 43 | $(AUTOF_DIR)/aferrors.h \ 44 | $(AUTOF_DIR)/aftypes.h 45 | 46 | 47 | # AUTOF driver object(s) 48 | # 49 | # AUTOF_DRV_OBJ_M is used during `multi' builds. 50 | # AUTOF_DRV_OBJ_S is used during `single' builds. 51 | # 52 | AUTOF_DRV_OBJ_M := $(AUTOF_DRV_SRC:$(AUTOF_DIR)/%.c=$(OBJ_DIR)/%.$O) 53 | AUTOF_DRV_OBJ_S := $(OBJ_DIR)/autofit.$O 54 | 55 | # AUTOF driver source file for single build 56 | # 57 | AUTOF_DRV_SRC_S := $(AUTOF_DIR)/autofit.c 58 | 59 | 60 | # AUTOF driver - single object 61 | # 62 | $(AUTOF_DRV_OBJ_S): $(AUTOF_DRV_SRC_S) $(AUTOF_DRV_SRC) \ 63 | $(FREETYPE_H) $(AUTOF_DRV_H) 64 | $(AUTOF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(AUTOF_DRV_SRC_S)) 65 | 66 | 67 | # AUTOF driver - multiple objects 68 | # 69 | $(OBJ_DIR)/%.$O: $(AUTOF_DIR)/%.c $(FREETYPE_H) $(AUTOF_DRV_H) 70 | $(AUTOF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) 71 | 72 | 73 | # update main driver object lists 74 | # 75 | DRV_OBJS_S += $(AUTOF_DRV_OBJ_S) 76 | DRV_OBJS_M += $(AUTOF_DRV_OBJ_M) 77 | 78 | 79 | # EOF 80 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Include/freetype/ttunpat.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttunpat.h */ 4 | /* */ 5 | /* Definitions for the unpatented TrueType hinting system */ 6 | /* */ 7 | /* Copyright 2003, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* Written by Graham Asher */ 11 | /* */ 12 | /* This file is part of the FreeType project, and may only be used, */ 13 | /* modified, and distributed under the terms of the FreeType project */ 14 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 15 | /* this file you indicate that you have read the license and */ 16 | /* understand and accept it fully. */ 17 | /* */ 18 | /***************************************************************************/ 19 | 20 | 21 | #ifndef __TTUNPAT_H__ 22 | #define __TTUNPAT_H__ 23 | 24 | 25 | #include 26 | #include FT_FREETYPE_H 27 | 28 | #ifdef FREETYPE_H 29 | #error "freetype.h of FreeType 1 has been loaded!" 30 | #error "Please fix the directory search order for header files" 31 | #error "so that freetype.h of FreeType 2 is found first." 32 | #endif 33 | 34 | 35 | FT_BEGIN_HEADER 36 | 37 | 38 | /*************************************************************************** 39 | * 40 | * @constant: 41 | * FT_PARAM_TAG_UNPATENTED_HINTING 42 | * 43 | * @description: 44 | * A constant used as the tag of an @FT_Parameter structure to indicate 45 | * that unpatented methods only should be used by the TrueType bytecode 46 | * interpreter for a typeface opened by @FT_Open_Face. 47 | * 48 | */ 49 | #define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) 50 | 51 | /* */ 52 | 53 | FT_END_HEADER 54 | 55 | 56 | #endif /* __TTUNPAT_H__ */ 57 | 58 | 59 | /* END */ 60 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/base/ftfstype.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftfstype.c */ 4 | /* */ 5 | /* FreeType utility file to access FSType data (body). */ 6 | /* */ 7 | /* Copyright 2008, 2009 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | #include 19 | #include FT_TYPE1_TABLES_H 20 | #include FT_TRUETYPE_TABLES_H 21 | #include FT_INTERNAL_SERVICE_H 22 | #include FT_SERVICE_POSTSCRIPT_INFO_H 23 | 24 | 25 | /* documentation is in freetype.h */ 26 | 27 | FT_EXPORT_DEF( FT_UShort ) 28 | FT_Get_FSType_Flags( FT_Face face ) 29 | { 30 | TT_OS2* os2; 31 | 32 | 33 | /* first, try to get the fs_type directly from the font */ 34 | if ( face ) 35 | { 36 | FT_Service_PsInfo service = NULL; 37 | 38 | 39 | FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO ); 40 | 41 | if ( service && service->ps_get_font_extra ) 42 | { 43 | PS_FontExtraRec extra; 44 | 45 | 46 | if ( !service->ps_get_font_extra( face, &extra ) && 47 | extra.fs_type != 0 ) 48 | return extra.fs_type; 49 | } 50 | } 51 | 52 | /* look at FSType before fsType for Type42 */ 53 | 54 | if ( ( os2 = (TT_OS2*)FT_Get_Sfnt_Table( face, ft_sfnt_os2 ) ) != NULL && 55 | os2->version != 0xFFFFU ) 56 | return os2->fsType; 57 | 58 | return 0; 59 | } 60 | 61 | 62 | /* END */ 63 | -------------------------------------------------------------------------------- /Terminal/Source/Log.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2016 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BEARLIBTERMINAL_LOG_HPP 24 | #define BEARLIBTERMINAL_LOG_HPP 25 | 26 | #include 27 | #include 28 | 29 | namespace BearLibTerminal 30 | { 31 | class Log 32 | { 33 | public: 34 | enum class Level {Fatal, Error, Warning, Info, Debug, Trace}; 35 | enum class Mode {Truncate, Append}; 36 | 37 | public: 38 | void Write(Level level, const std::wstring& what); 39 | void Reset(); 40 | static Log& Instance(); 41 | std::wstring filename; 42 | Level level; 43 | Mode mode; 44 | 45 | private: 46 | Log(); 47 | bool m_truncated; 48 | }; 49 | 50 | std::wostream& operator<< (std::wostream& stream, Log::Level value); 51 | std::wistream& operator>> (std::wistream& stream, Log::Level& value); 52 | 53 | std::wostream& operator<< (std::wostream& stream, Log::Mode value); 54 | std::wistream& operator>> (std::wistream& stream, Log::Mode& mode); 55 | } 56 | 57 | #define LOG(level_, what)\ 58 | do\ 59 | {\ 60 | if (BearLibTerminal::Log::Level::level_ <= BearLibTerminal::Log::Instance().level)\ 61 | {\ 62 | std::wostringstream wss_;\ 63 | wss_ << what;\ 64 | BearLibTerminal::Log::Instance().Write(BearLibTerminal::Log::Level::level_, wss_.str());\ 65 | }\ 66 | }\ 67 | while (0) 68 | 69 | #endif // BEARLIBTERMINAL_LOG_HPP 70 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/smooth/ftgrays.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftgrays.h */ 4 | /* */ 5 | /* FreeType smooth renderer declaration */ 6 | /* */ 7 | /* Copyright 1996-2001 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __FTGRAYS_H__ 20 | #define __FTGRAYS_H__ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | 27 | #ifdef _STANDALONE_ 28 | #include "ftimage.h" 29 | #else 30 | #include 31 | #include FT_CONFIG_CONFIG_H /* for FT_CONFIG_OPTION_PIC */ 32 | #include FT_IMAGE_H 33 | #endif 34 | 35 | 36 | /*************************************************************************/ 37 | /* */ 38 | /* To make ftgrays.h independent from configuration files we check */ 39 | /* whether FT_EXPORT_VAR has been defined already. */ 40 | /* */ 41 | /* On some systems and compilers (Win32 mostly), an extra keyword is */ 42 | /* necessary to compile the library as a DLL. */ 43 | /* */ 44 | #ifndef FT_EXPORT_VAR 45 | #define FT_EXPORT_VAR( x ) extern x 46 | #endif 47 | 48 | FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_grays_raster; 49 | 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif /* __FTGRAYS_H__ */ 56 | 57 | 58 | /* END */ 59 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Include/freetype/internal/services/svpfr.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svpfr.h */ 4 | /* */ 5 | /* Internal PFR service functions (specification). */ 6 | /* */ 7 | /* Copyright 2003, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVPFR_H__ 20 | #define __SVPFR_H__ 21 | 22 | #include FT_PFR_H 23 | #include FT_INTERNAL_SERVICE_H 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | 29 | #define FT_SERVICE_ID_PFR_METRICS "pfr-metrics" 30 | 31 | 32 | typedef FT_Error 33 | (*FT_PFR_GetMetricsFunc)( FT_Face face, 34 | FT_UInt *aoutline, 35 | FT_UInt *ametrics, 36 | FT_Fixed *ax_scale, 37 | FT_Fixed *ay_scale ); 38 | 39 | typedef FT_Error 40 | (*FT_PFR_GetKerningFunc)( FT_Face face, 41 | FT_UInt left, 42 | FT_UInt right, 43 | FT_Vector *avector ); 44 | 45 | typedef FT_Error 46 | (*FT_PFR_GetAdvanceFunc)( FT_Face face, 47 | FT_UInt gindex, 48 | FT_Pos *aadvance ); 49 | 50 | 51 | FT_DEFINE_SERVICE( PfrMetrics ) 52 | { 53 | FT_PFR_GetMetricsFunc get_metrics; 54 | FT_PFR_GetKerningFunc get_kerning; 55 | FT_PFR_GetAdvanceFunc get_advance; 56 | 57 | }; 58 | 59 | /* */ 60 | 61 | FT_END_HEADER 62 | 63 | #endif /* __SVPFR_H__ */ 64 | 65 | 66 | /* END */ 67 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/smooth/ftspic.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftspic.h */ 4 | /* */ 5 | /* The FreeType position independent code services for smooth module. */ 6 | /* */ 7 | /* Copyright 2009 by */ 8 | /* Oran Agra and Mickey Gabel. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __FTSPIC_H__ 20 | #define __FTSPIC_H__ 21 | 22 | 23 | FT_BEGIN_HEADER 24 | 25 | #include FT_INTERNAL_PIC_H 26 | 27 | #ifndef FT_CONFIG_OPTION_PIC 28 | #define FT_GRAYS_RASTER_GET ft_grays_raster 29 | 30 | #else /* FT_CONFIG_OPTION_PIC */ 31 | 32 | typedef struct SmoothPIC_ 33 | { 34 | int ref_count; 35 | FT_Raster_Funcs ft_grays_raster; 36 | } SmoothPIC; 37 | 38 | #define GET_PIC(lib) ((SmoothPIC*)((lib)->pic_container.smooth)) 39 | #define FT_GRAYS_RASTER_GET (GET_PIC(library)->ft_grays_raster) 40 | 41 | /* see ftspic.c for the implementation */ 42 | void 43 | ft_smooth_renderer_class_pic_free( FT_Library library ); 44 | 45 | void 46 | ft_smooth_lcd_renderer_class_pic_free( FT_Library library ); 47 | 48 | void 49 | ft_smooth_lcdv_renderer_class_pic_free( FT_Library library ); 50 | 51 | FT_Error 52 | ft_smooth_renderer_class_pic_init( FT_Library library ); 53 | 54 | FT_Error 55 | ft_smooth_lcd_renderer_class_pic_init( FT_Library library ); 56 | 57 | FT_Error 58 | ft_smooth_lcdv_renderer_class_pic_init( FT_Library library ); 59 | 60 | #endif /* FT_CONFIG_OPTION_PIC */ 61 | 62 | /* */ 63 | 64 | FT_END_HEADER 65 | 66 | #endif /* __FTSPIC_H__ */ 67 | 68 | 69 | /* END */ 70 | -------------------------------------------------------------------------------- /Terminal/Source/LoadBitmap.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | #include "LoadBitmap.hpp" 26 | #include "Log.hpp" 27 | 28 | // Forward declarations. See LoadXXX.cpp files for definitions. 29 | namespace BearLibTerminal 30 | { 31 | Bitmap LoadBMP(std::istream& stream); 32 | Bitmap LoadPNG(std::istream& stream); 33 | Bitmap LoadJPEG(std::istream& stream); 34 | } 35 | 36 | namespace BearLibTerminal 37 | { 38 | Bitmap LoadBitmap(const std::vector& data) 39 | { 40 | if (data.size() < 4) 41 | throw std::runtime_error("LoadBitmap: invalid data size"); 42 | 43 | unsigned char magic_bytes[4] = {data[0], data[1], data[2], data[3]}; 44 | 45 | // FIXME: rewrite bitmap loading routines. Maybe just use stb_image? 46 | std::istringstream stream{std::string((const char*)&data[0], data.size())}; 47 | 48 | if (!strncmp((const char*)magic_bytes, "\x89PNG", 4)) 49 | { 50 | // This must be PNG resource 51 | return LoadPNG(stream); 52 | } 53 | else if (!strncmp((const char*)magic_bytes, "BM", 2)) 54 | { 55 | // This must be BMP DIB resource 56 | return LoadBMP(stream); 57 | } 58 | else if (!strncmp((const char*)magic_bytes, "\xFF\xD8", 2)) 59 | { 60 | // Must be a JPEG rsource 61 | return LoadJPEG(stream); 62 | } 63 | else 64 | { 65 | throw std::runtime_error("unsupported image format"); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Terminal/Source/Window.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2016 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "Window.hpp" 24 | #if defined(__linux) 25 | #include "X11Window.hpp" 26 | #endif 27 | #if defined(_WIN32) 28 | #include "WinApiWindow.hpp" 29 | #endif 30 | #if defined(__APPLE__) 31 | #include "CocoaWindow.h" 32 | #endif 33 | #include "Log.hpp" 34 | #include "Utility.hpp" 35 | 36 | namespace BearLibTerminal 37 | { 38 | Window::Window(EventHandler handler): 39 | m_event_handler(handler), 40 | m_minimum_size(1, 1), 41 | m_fullscreen(false), 42 | m_resizeable(false) 43 | { } 44 | 45 | Window::~Window() 46 | { } 47 | 48 | void Window::SetSizeHints(Size increment, Size minimum_size) 49 | { 50 | m_cell_size = increment; 51 | m_minimum_size = minimum_size; 52 | 53 | if (m_minimum_size.width < 1) m_minimum_size.width = 1; 54 | if (m_minimum_size.height < 1) m_minimum_size.height = 1; 55 | } 56 | 57 | bool Window::IsFullscreen() const 58 | { 59 | return m_fullscreen; 60 | } 61 | 62 | std::wstring Window::GetClipboard() 63 | { 64 | return std::wstring{}; 65 | } 66 | 67 | std::unique_ptr Window::Create(EventHandler handler) 68 | { 69 | #if defined(__linux) 70 | return std::make_unique(handler); 71 | #endif 72 | #if defined(_WIN32) 73 | return std::make_unique(handler); 74 | #endif 75 | #if defined(__APPLE__) 76 | return std::make_unique(handler); 77 | #endif 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Samples/Omni/Source/Tilesets.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Tilesets.cpp 3 | * 4 | * Created on: Nov 27, 2013 5 | * Author: cfyz 6 | */ 7 | 8 | #include "Common.hpp" 9 | #include 10 | 11 | void TestTilesets() 12 | { 13 | terminal_set("window.title='Omni: tilesets'"); 14 | terminal_composition(TK_ON); 15 | 16 | // Load tilesets 17 | terminal_set("U+E100: ../Media/Runic.png, size=8x16"); 18 | terminal_set("U+E200: ../Media/Tiles.png, size=32x32, align=top-left"); 19 | terminal_set("U+E300: ../Media/fontawesome-webfont.ttf, size=24x24, spacing=3x2, codepage=../Media/fontawesome-codepage.txt"); 20 | terminal_set("zodiac font: ../Media/Zodiac-S.ttf, size=24x36, spacing=3x3, codepage=437"); 21 | 22 | terminal_clear(); 23 | terminal_color("white"); 24 | 25 | terminal_print(2, 1, "[color=orange]1.[/color] Of course, there is default font tileset."); 26 | 27 | terminal_print(2, 3, "[color=orange]2.[/color] You can load some arbitrary tiles and use them as glyphs:"); 28 | terminal_print 29 | ( 30 | 2+3, 4, 31 | "Fire rune ([color=red][U+E102][/color]), " 32 | "water rune ([color=lighter blue][U+E103][/color]), " 33 | "earth rune ([color=darker green][U+E104][/color])" 34 | ); 35 | 36 | terminal_print(2, 6, "[color=orange]3.[/color] Tiles are not required to be of the same size as font symbols:"); 37 | terminal_put(2+3+0, 7, 0xE200+7); 38 | terminal_put(2+3+5, 7, 0xE200+8); 39 | terminal_put(2+3+10, 7, 0xE200+9); 40 | 41 | terminal_print(2, 10, "[color=orange]4.[/color] Like font characters, tiles may be freely colored and combined:"); 42 | terminal_put(2+3+0, 11, 0xE200+8); 43 | terminal_color("lighter orange"); 44 | terminal_put(2+3+5, 11, 0xE200+8); 45 | terminal_color("orange"); 46 | terminal_put(2+3+10, 11, 0xE200+8); 47 | terminal_color("dark orange"); 48 | terminal_put(2+3+15, 11, 0xE200+8); 49 | 50 | terminal_color("white"); 51 | std::vector order = {11, 10, 14, 12, 13}; 52 | for (int i=0; iget_location = get_location_; \ 56 | } 57 | 58 | #endif /* FT_CONFIG_OPTION_PIC */ 59 | 60 | /* */ 61 | 62 | 63 | FT_END_HEADER 64 | 65 | #endif /* __SVTTGLYF_H__ */ 66 | 67 | 68 | /* END */ 69 | -------------------------------------------------------------------------------- /Terminal/Source/Stage.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013-2014 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BEARLIBTERMINAL_STAGE_HPP 24 | #define BEARLIBTERMINAL_STAGE_HPP 25 | 26 | #include "Atlas.hpp" 27 | #include "Color.hpp" 28 | #include "Tileset.hpp" 29 | #include 30 | #include 31 | #include 32 | 33 | namespace BearLibTerminal 34 | { 35 | struct Leaf 36 | { 37 | Leaf(); 38 | Color color[4]; 39 | int16_t dx, dy; 40 | char32_t code; 41 | uint8_t flags; 42 | uint8_t reserved; 43 | static const uint8_t CornerColored = 0x01; 44 | }; 45 | 46 | struct Cell 47 | { 48 | std::vector leafs; 49 | }; 50 | 51 | struct Layer 52 | { 53 | Layer(Size size); 54 | std::vector cells; 55 | Rectangle crop; 56 | }; 57 | 58 | struct Scene 59 | { 60 | std::vector layers; 61 | std::vector background; 62 | }; 63 | 64 | struct Stage 65 | { 66 | Size size; 67 | Scene frontbuffer; 68 | Scene backbuffer; 69 | void Resize(Size size); 70 | }; 71 | 72 | struct State 73 | { 74 | Size cellsize; // Current cellsize; different from Options.window_cellsize in that this one is always properly set. 75 | Size half_cellsize; // Cached value used in leaf drawing. 76 | Color color; 77 | Color bkcolor; 78 | int composition; 79 | int layer; 80 | char32_t font_offset; 81 | State(); 82 | }; 83 | 84 | struct World 85 | { 86 | Stage stage; 87 | State state; 88 | }; 89 | } 90 | 91 | #endif // BEARLIBTERMINAL_STAGE_HPP 92 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/truetype/ttpload.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttpload.h */ 4 | /* */ 5 | /* TrueType-specific tables loader (specification). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2002, 2005, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __TTPLOAD_H__ 20 | #define __TTPLOAD_H__ 21 | 22 | 23 | #include 24 | #include FT_INTERNAL_TRUETYPE_TYPES_H 25 | 26 | 27 | FT_BEGIN_HEADER 28 | 29 | 30 | FT_LOCAL( FT_Error ) 31 | tt_face_load_loca( TT_Face face, 32 | FT_Stream stream ); 33 | 34 | FT_LOCAL( FT_ULong ) 35 | tt_face_get_location( TT_Face face, 36 | FT_UInt gindex, 37 | FT_UInt *asize ); 38 | 39 | FT_LOCAL( void ) 40 | tt_face_done_loca( TT_Face face ); 41 | 42 | FT_LOCAL( FT_Error ) 43 | tt_face_load_cvt( TT_Face face, 44 | FT_Stream stream ); 45 | 46 | FT_LOCAL( FT_Error ) 47 | tt_face_load_fpgm( TT_Face face, 48 | FT_Stream stream ); 49 | 50 | 51 | FT_LOCAL( FT_Error ) 52 | tt_face_load_prep( TT_Face face, 53 | FT_Stream stream ); 54 | 55 | 56 | FT_LOCAL( FT_Error ) 57 | tt_face_load_hdmx( TT_Face face, 58 | FT_Stream stream ); 59 | 60 | 61 | FT_LOCAL( void ) 62 | tt_face_free_hdmx( TT_Face face ); 63 | 64 | 65 | FT_LOCAL( FT_Byte* ) 66 | tt_face_get_device_metrics( TT_Face face, 67 | FT_UInt ppem, 68 | FT_UInt gindex ); 69 | 70 | FT_END_HEADER 71 | 72 | #endif /* __TTPLOAD_H__ */ 73 | 74 | 75 | /* END */ 76 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/autofit/afloader.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* afloader.h */ 4 | /* */ 5 | /* Auto-fitter glyph loading routines (specification). */ 6 | /* */ 7 | /* Copyright 2003-2005, 2011-2012 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __AFLOADER_H__ 20 | #define __AFLOADER_H__ 21 | 22 | #include "afhints.h" 23 | #include "afglobal.h" 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | typedef struct AF_LoaderRec_ 29 | { 30 | FT_Face face; /* current face */ 31 | AF_FaceGlobals globals; /* current face globals */ 32 | FT_GlyphLoader gloader; /* glyph loader */ 33 | AF_GlyphHintsRec hints; 34 | AF_ScriptMetrics metrics; 35 | FT_Bool transformed; 36 | FT_Matrix trans_matrix; 37 | FT_Vector trans_delta; 38 | FT_Vector pp1; 39 | FT_Vector pp2; 40 | /* we don't handle vertical phantom points */ 41 | 42 | } AF_LoaderRec, *AF_Loader; 43 | 44 | 45 | FT_LOCAL( FT_Error ) 46 | af_loader_init( AF_Loader loader, 47 | FT_Memory memory ); 48 | 49 | 50 | FT_LOCAL( FT_Error ) 51 | af_loader_reset( AF_Loader loader, 52 | FT_Face face ); 53 | 54 | 55 | FT_LOCAL( void ) 56 | af_loader_done( AF_Loader loader ); 57 | 58 | 59 | FT_LOCAL( FT_Error ) 60 | af_loader_load_glyph( AF_Loader loader, 61 | FT_Face face, 62 | FT_UInt gindex, 63 | FT_Int32 load_flags ); 64 | 65 | /* */ 66 | 67 | 68 | FT_END_HEADER 69 | 70 | #endif /* __AFLOADER_H__ */ 71 | 72 | 73 | /* END */ 74 | -------------------------------------------------------------------------------- /Samples/Omni/Source/ManualCellsize.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TestManualCellsize.cpp 3 | * 4 | * Created on: Nov 27, 2013 5 | * Author: cfyz 6 | */ 7 | 8 | #include "Common.hpp" 9 | #include 10 | #include 11 | 12 | void TestManualCellsize() 13 | { 14 | terminal_set("window.title='Omni: manual cellsize'"); 15 | 16 | const char* font_name = "../Media/VeraMono.ttf"; 17 | std::vector font_hintings = {"normal", "autohint", "none"}; 18 | int font_hinting = 0; 19 | int font_size = 12; 20 | int cell_width = 8; 21 | int cell_height = 16; 22 | 23 | auto setup_font = [&](){terminal_setf("font: %s, size=%d, hinting=%s", font_name, font_size, font_hintings[font_hinting].c_str());}; 24 | auto setup_cellsize = [&](){terminal_setf("window: cellsize=%dx%d", cell_width, cell_height);}; 25 | 26 | setup_cellsize(); 27 | setup_font(); 28 | 29 | while (true) 30 | { 31 | terminal_clear(); 32 | terminal_color("white"); 33 | 34 | terminal_printf(2, 1, "Hello, world!"); 35 | terminal_printf(2, 3, "[color=orange]Font size:[/color] %d", font_size); 36 | terminal_printf(2, 4, "[color=orange]Font hinting:[/color] %s", font_hintings[font_hinting].c_str()); 37 | terminal_printf(2, 5, "[color=orange]Cell size:[/color] %dx%d", cell_width, cell_height); 38 | terminal_printf(2, 7, "[color=orange]TIP:[/color] Use arrow keys to change cell size"); 39 | terminal_printf(2, 8, "[color=orange]TIP:[/color] Use Shift+Up/Down arrow keys to change font size"); 40 | terminal_printf(2, 9, "[color=orange]TIP:[/color] Use TAB to switch font hinting mode"); 41 | 42 | terminal_refresh(); 43 | 44 | int key = terminal_read(); 45 | 46 | if (key == TK_CLOSE || key == TK_ESCAPE) 47 | { 48 | break; 49 | } 50 | else if (key == TK_LEFT && !terminal_state(TK_SHIFT) && cell_width > 4) 51 | { 52 | cell_width -= 1; 53 | setup_cellsize(); 54 | } 55 | else if (key == TK_RIGHT && !terminal_state(TK_SHIFT) && cell_width < 24) 56 | { 57 | cell_width += 1; 58 | setup_cellsize(); 59 | } 60 | else if (key == TK_DOWN && !terminal_state(TK_SHIFT) && cell_height < 24) 61 | { 62 | cell_height += 1; 63 | setup_cellsize(); 64 | } 65 | else if (key == TK_UP && !terminal_state(TK_SHIFT) && cell_height > 4) 66 | { 67 | cell_height -= 1; 68 | setup_cellsize(); 69 | } 70 | else if (key == TK_UP && terminal_state(TK_SHIFT) && font_size < 64) 71 | { 72 | font_size += 1; 73 | setup_font(); 74 | } 75 | else if (key == TK_DOWN && terminal_state(TK_SHIFT) && font_size > 4) 76 | { 77 | font_size -= 1; 78 | setup_font(); 79 | } 80 | else if (key == TK_TAB) 81 | { 82 | font_hinting = (font_hinting + 1) % font_hintings.size(); 83 | setup_font(); 84 | } 85 | } 86 | 87 | terminal_set("font: default; window.cellsize=auto"); 88 | } 89 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Include/freetype/internal/ftpic.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftpic.h */ 4 | /* */ 5 | /* The FreeType position independent code services (declaration). */ 6 | /* */ 7 | /* Copyright 2009 by */ 8 | /* Oran Agra and Mickey Gabel. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | /*************************************************************************/ 19 | /* */ 20 | /* Modules that ordinarily have const global data that need address */ 21 | /* can instead define pointers here. */ 22 | /* */ 23 | /*************************************************************************/ 24 | 25 | 26 | #ifndef __FTPIC_H__ 27 | #define __FTPIC_H__ 28 | 29 | 30 | FT_BEGIN_HEADER 31 | 32 | #ifdef FT_CONFIG_OPTION_PIC 33 | 34 | typedef struct FT_PIC_Container_ 35 | { 36 | /* pic containers for base */ 37 | void* base; 38 | /* pic containers for modules */ 39 | void* autofit; 40 | void* cff; 41 | void* pshinter; 42 | void* psnames; 43 | void* raster; 44 | void* sfnt; 45 | void* smooth; 46 | void* truetype; 47 | } FT_PIC_Container; 48 | 49 | /* Initialize the various function tables, structs, etc. stored in the container. */ 50 | FT_BASE( FT_Error ) 51 | ft_pic_container_init( FT_Library library ); 52 | 53 | 54 | /* Destroy the contents of the container. */ 55 | FT_BASE( void ) 56 | ft_pic_container_destroy( FT_Library library ); 57 | 58 | #endif /* FT_CONFIG_OPTION_PIC */ 59 | 60 | /* */ 61 | 62 | FT_END_HEADER 63 | 64 | #endif /* __FTPIC_H__ */ 65 | 66 | 67 | /* END */ 68 | -------------------------------------------------------------------------------- /Samples/Omni/Source/InputFiltering.cpp: -------------------------------------------------------------------------------- 1 | #include "Common.hpp" 2 | #include 3 | #include 4 | 5 | void TestInputFiltering() 6 | { 7 | terminal_set("window.title='Omni: input filtering'"); 8 | 9 | std::vector> events = 10 | { 11 | {"0123456789", 1}, // 0 - disabled, 1 - keypress, 2 - both keypress and keyrelease 12 | {"close", 1}, 13 | {"escape", 1}, 14 | {"q", 0}, 15 | {"abc", 0}, 16 | {"keyboard", 0}, 17 | {"mouse-left", 0}, 18 | {"mouse", 0} 19 | }; 20 | 21 | const char* colors[] = {"dark gray", "white", "lightest blue"}; 22 | 23 | auto apply_input_filter = [&events]() 24 | { 25 | std::ostringstream ss; 26 | for (auto& event: events) 27 | { 28 | if (event.second == 0) continue; // disabled 29 | ss << event.first; // keypress 30 | if (event.second == 2) ss << "+"; // keyrelease too 31 | ss << ", "; 32 | } 33 | 34 | terminal_setf("input.filter=[%s]", ss.str().c_str()); 35 | }; 36 | 37 | apply_input_filter(); 38 | 39 | int event_counter = 0; 40 | 41 | for (bool proceed=true; proceed;) 42 | { 43 | terminal_clear(); 44 | terminal_color("white"); 45 | 46 | int h = terminal_printf_ext 47 | ( 48 | 2, 1, 76, 0, TK_ALIGN_DEFAULT, 49 | "Modify input filter by pressing corresponding numbers (digits are added " 50 | "to filter automatically). Gray color ([color=%s]like this[/color]) means that " 51 | "event is disabled. Regular white color means keypress is enabled. Blueish color " 52 | "([color=%s]like this[/color]) means both keypress and keyrelease are enabled.\n\n" 53 | "Both CLOSE and ESCAPE close this demo.", 54 | colors[0], colors[2] 55 | ).height; 56 | 57 | for (size_t i = 0; i < events.size(); i++) 58 | { 59 | terminal_printf 60 | ( 61 | 2, 1+h+1+i, 62 | "[color=orange]%i[/color]. [color=%s]%s", 63 | i, colors[events[i].second], events[i].first 64 | ); 65 | } 66 | 67 | terminal_printf 68 | ( 69 | 2, 1+h+1+events.size()+1, 70 | "Events read: [color=orange]%i", 71 | event_counter 72 | ); 73 | 74 | terminal_refresh(); 75 | 76 | do 77 | { 78 | int key = terminal_read(); 79 | event_counter += 1; 80 | 81 | if (key == TK_CLOSE || key == TK_ESCAPE) 82 | { 83 | proceed = false; 84 | break; 85 | } 86 | else if (key >= TK_1 && key <= TK_9) 87 | { 88 | int index = (key - TK_1) + 1; 89 | if (index < events.size()) 90 | { 91 | auto& event = events[index]; 92 | event.second = (event.second + 1) % 3; 93 | } 94 | 95 | apply_input_filter(); 96 | } 97 | } 98 | while (proceed && terminal_has_input()); 99 | } 100 | 101 | terminal_set("input.filter={keyboard}"); 102 | } 103 | -------------------------------------------------------------------------------- /Terminal/Source/Color.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BearLibTerminal 3 | * Copyright (C) 2013 Cfyz 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is furnished to do 10 | * so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef BEARLIBTERMINAL_COLOR_HPP 24 | #define BEARLIBTERMINAL_COLOR_HPP 25 | 26 | #include 27 | 28 | namespace BearLibTerminal 29 | { 30 | struct Color 31 | { 32 | std::uint8_t b, g, r, a; // BGRA8 format 33 | 34 | Color(): 35 | b(0), g(0), r(0), a(0) 36 | { } 37 | 38 | Color(std::uint8_t alpha, std::uint8_t red, std::uint8_t green, std::uint8_t blue): 39 | b(blue), g(green), r(red), a(alpha) 40 | { } 41 | 42 | Color(std::uint8_t red, std::uint8_t green, std::uint8_t blue): 43 | b(blue), g(green), r(red), a(0xFF) 44 | { } 45 | 46 | Color(std::uint32_t bgra) 47 | { 48 | *(std::uint32_t*)this = bgra; 49 | } 50 | 51 | bool operator== (const Color& another) const 52 | { 53 | return *(const std::uint32_t*)this == *(const std::uint32_t*)&another; 54 | } 55 | 56 | bool operator!= (const Color& another) const 57 | { 58 | return !(*this == another); 59 | } 60 | 61 | operator uint32_t() const 62 | { 63 | return *(const std::uint32_t*)this; 64 | } 65 | 66 | Color operator+ (Color other) 67 | { 68 | return Color(r+other.r, g+other.g, b+other.b, a+other.a); 69 | } 70 | }; 71 | 72 | struct HSV 73 | { 74 | HSV(): 75 | h(0), s(0), v(0), a(255) 76 | { } 77 | 78 | HSV(uint8_t h, uint8_t s, uint8_t v): 79 | h(h), s(s), v(v), a(255) 80 | { } 81 | 82 | HSV(uint8_t a, uint8_t h, uint8_t s, uint8_t v): 83 | h(h), s(s), v(v), a(a) 84 | { } 85 | 86 | uint8_t h, s, v, a; 87 | }; 88 | } 89 | 90 | #endif // BEARLIBTERMINAL_COLOR_HPP 91 | -------------------------------------------------------------------------------- /Terminal/Dependencies/FreeType/Source/truetype/ttpic.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttpic.h */ 4 | /* */ 5 | /* The FreeType position independent code services for truetype module. */ 6 | /* */ 7 | /* Copyright 2009 by */ 8 | /* Oran Agra and Mickey Gabel. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __TTPIC_H__ 20 | #define __TTPIC_H__ 21 | 22 | 23 | FT_BEGIN_HEADER 24 | 25 | #ifndef FT_CONFIG_OPTION_PIC 26 | #define FT_TT_SERVICES_GET tt_services 27 | #define FT_TT_SERVICE_GX_MULTI_MASTERS_GET tt_service_gx_multi_masters 28 | #define FT_TT_SERVICE_TRUETYPE_GLYF_GET tt_service_truetype_glyf 29 | 30 | #else /* FT_CONFIG_OPTION_PIC */ 31 | 32 | #include FT_MULTIPLE_MASTERS_H 33 | #include FT_SERVICE_MULTIPLE_MASTERS_H 34 | #include FT_SERVICE_TRUETYPE_GLYF_H 35 | 36 | typedef struct TTModulePIC_ 37 | { 38 | FT_ServiceDescRec* tt_services; 39 | #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT 40 | FT_Service_MultiMastersRec tt_service_gx_multi_masters; 41 | #endif 42 | FT_Service_TTGlyfRec tt_service_truetype_glyf; 43 | } TTModulePIC; 44 | 45 | #define GET_PIC(lib) ((TTModulePIC*)((lib)->pic_container.truetype)) 46 | #define FT_TT_SERVICES_GET (GET_PIC(library)->tt_services) 47 | #define FT_TT_SERVICE_GX_MULTI_MASTERS_GET (GET_PIC(library)->tt_service_gx_multi_masters) 48 | #define FT_TT_SERVICE_TRUETYPE_GLYF_GET (GET_PIC(library)->tt_service_truetype_glyf) 49 | 50 | /* see ttpic.c for the implementation */ 51 | void 52 | tt_driver_class_pic_free( FT_Library library ); 53 | 54 | FT_Error 55 | tt_driver_class_pic_init( FT_Library library ); 56 | 57 | #endif /* FT_CONFIG_OPTION_PIC */ 58 | 59 | /* */ 60 | 61 | FT_END_HEADER 62 | 63 | #endif /* __TTPIC_H__ */ 64 | 65 | 66 | /* END */ 67 | -------------------------------------------------------------------------------- /Terminal/Include/Python/README.md: -------------------------------------------------------------------------------- 1 | ### Using BearLibTerminal 2 | 3 | There are two ways to setup BearLibTerminal for Python. 4 | 5 | #### 1. Using the package from PyPi 6 | 7 | Install the package via pip: 8 | 9 | pip install bearlibterminal 10 | 11 | Depending on the OS and Python installation, you might also want to 12 | 13 | - Replace `pip` with `pip3` or `python3 -m pip` to select a correct version of Python. 14 | - Add `--user` flag to install package locally (i. e. user-wide). 15 | 16 | The package contains both wrapper and an appropriate binary for the platform, so you do not need to copy anything else anywhere. Just import the library in the source: 17 | 18 | from bearlibterminal import terminal 19 | 20 | terminal.open() 21 | terminal.printf(2, 1, "Hello, world!") 22 | terminal.refresh() 23 | while terminal.read() != terminal.TK_CLOSE: 24 | pass 25 | terminal.close() 26 | 27 | #### 2. Copying package files into the project source 28 | 29 | This makes project a bit more stable and self-sufficient but less portable. 30 | 31 | Copy the following files into your project source: 32 | - The `bearlibterminal` directory from here 33 | - The library binary into the previously copied `bearlibterminal` directory 34 | 35 | E. g. 36 | 37 | Game/ 38 | bearlibterminal/ 39 | __init__.py 40 | terminal.py 41 | BearLibTerminal.dll 42 | game.py 43 | 44 | Then you can use it similarly to an installed package: 45 | 46 | from bearlibterminal import terminal 47 | 48 | 49 | #### 2b. Copying the wrapper and binary files only 50 | 51 | Or you can copy only the bare minimum: 52 | 53 | Game/ 54 | terminal.py 55 | BearLibTerminal.dll 56 | game.py 57 | 58 | And import the module like this: 59 | 60 | import terminal 61 | 62 | The wrapper may be placed/renamed however you like, the only requirement is for the binary to be in the same directory with the wrapper. 63 | 64 | 65 | ### Building a Python wheel package 66 | 67 | This directory contains a package skeleton. To build a package, a few more files are necessary: 68 | 69 | - CHANGELOG.md here in the root (setup.py uses it to fetch the version) 70 | - A library binary in the `bearlibterminal` directory (near the `terminal.py`) 71 | 72 | One has to manually copy these files from source and build trees because pip does not copy files from outside directories when building the package. 73 | 74 | For example, from a Linux build directory: 75 | 76 | cp -R ../Terminal/Include/Python ./ 77 | cp ../CHANGELOG.md ./Python/ 78 | cp ../Output/Linux64/libBearLibTerminal.so ./Python/bearlibterminal/ 79 | pip wheel --build-option '--python-tag=py2.py3' --build-option '--plat-name=manylinux1_x86_64' ./Python 80 | --------------------------------------------------------------------------------