Browse Source

Improve documentation and changelog.

Michael Ragazzon 6 years ago
parent
commit
25d0cf4051

+ 6 - 1
Include/RmlUi/Core/ComputedValues.h

@@ -127,7 +127,12 @@ enum class OriginX : uint8_t { Left, Center, Right };
 enum class OriginY : uint8_t { Top, Center, Bottom };
 enum class OriginY : uint8_t { Top, Center, Bottom };
 
 
 
 
-// A computed value is a value resolved as far as possible :before: updating layout. See CSS specs for details of each property.
+/* 
+	A computed value is a value resolved as far as possible :before: introducing layouting. See CSS specs for details of each property.
+
+	Note: Enums and default values must correspond to the keywords and defaults in `StyleSheetSpecification.cpp`.
+*/
+
 struct ComputedValues
 struct ComputedValues
 {
 {
 	Margin margin_top, margin_right, margin_bottom, margin_left;
 	Margin margin_top, margin_right, margin_bottom, margin_left;

+ 11 - 1
Include/RmlUi/Core/FontEngineInterface.h

@@ -30,11 +30,21 @@
 
 
 #include "Header.h"
 #include "Header.h"
 #include "Types.h"
 #include "Types.h"
+#include "ComputedValues.h"
 #include "Geometry.h"
 #include "Geometry.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {
 
 
+
+/**
+	The abstract base class for an application-specific font engine implementation.
+	
+	By default, RmlUi will use its own font engine with characters rendered through FreeType. To use your own engine,
+	provide a concrete implementation of this class and install it through Core::SetFontEngineInterface().
+ */
+
+
 class RMLUICORE_API FontEngineInterface
 class RMLUICORE_API FontEngineInterface
 {
 {
 public:
 public:
@@ -117,7 +127,7 @@ public:
 	/// Called by RmlUi to determine if the text geometry is required to be re-generated. Whenever the returned version
 	/// Called by RmlUi to determine if the text geometry is required to be re-generated. Whenever the returned version
 	/// is changed, all geometry belonging to the given face handle will be re-generated.
 	/// is changed, all geometry belonging to the given face handle will be re-generated.
 	/// @param[in] face_handle The font handle.
 	/// @param[in] face_handle The font handle.
-	/// @return The version required for using the geometry.
+	/// @return The version required for using any geometry generated with the face handle.
 	virtual int GetVersion(FontFaceHandle handle);
 	virtual int GetVersion(FontFaceHandle handle);
 };
 };
 
 

+ 0 - 1
Samples/basic/bitmapfont/src/FontEngineInterfaceBitmap.h

@@ -32,7 +32,6 @@
 #include <RmlUi/Core/Types.h>
 #include <RmlUi/Core/Types.h>
 #include <RmlUi/Core/Context.h>
 #include <RmlUi/Core/Context.h>
 #include <RmlUi/Core/FontEngineInterface.h>
 #include <RmlUi/Core/FontEngineInterface.h>
-#include <RmlUi/Core/Spritesheet.h>
 
 
 using Rml::Core::FontFaceHandle;
 using Rml::Core::FontFaceHandle;
 using Rml::Core::FontEffectsHandle;
 using Rml::Core::FontEffectsHandle;

+ 1 - 1
Source/Core/FontEngineDefault/FontFaceLayer.cpp

@@ -122,7 +122,7 @@ bool FontFaceLayer::Generate(const FontFaceHandleDefault* handle, const FontFace
 			texture_layout.AddRectangle((int)character, glyph_dimensions - glyph_origin);
 			texture_layout.AddRectangle((int)character, glyph_dimensions - glyph_origin);
 		}
 		}
 
 
-		constexpr int max_texture_dimensions = 2048;
+		constexpr int max_texture_dimensions = 1024;
 
 
 		// Generate the texture layout; this will position the glyph rectangles efficiently and
 		// Generate the texture layout; this will position the glyph rectangles efficiently and
 		// allocate the texture data ready for writing.
 		// allocate the texture data ready for writing.

+ 10 - 1
Source/Core/StyleSheetSpecification.cpp

@@ -238,7 +238,16 @@ void StyleSheetSpecification::RegisterDefaultParsers()
 // Registers RmlUi's default style properties.
 // Registers RmlUi's default style properties.
 void StyleSheetSpecification::RegisterDefaultProperties()
 void StyleSheetSpecification::RegisterDefaultProperties()
 {
 {
-	// Style property specifications (ala RCSS).
+	/* 
+		Style property specifications (ala RCSS).
+
+		Note: Whenever keywords or default values are changed, make sure its computed value is
+		changed correspondingly, see `ComputedValues.h`.
+
+		When adding new properties, it may be desirable to add it to the computed values as well.
+		Then, make sure to resolve it as appropriate in `ElementStyle.cpp`.
+
+	*/
 
 
 	RegisterProperty(PropertyId::MarginTop, MARGIN_TOP, "0px", false, true)
 	RegisterProperty(PropertyId::MarginTop, MARGIN_TOP, "0px", false, true)
 		.AddParser("keyword", "auto")
 		.AddParser("keyword", "auto")

+ 42 - 2
readme.md

@@ -158,6 +158,33 @@ decorator: ninepatch( button-outer, button-inner, 1.0 );
 is a simple approach to scale the decorators with higher dp ratios. For crisper graphics, increase the sprite sheet's pixel size at the edges and lower the rendered edge size number correspondingly.
 is a simple approach to scale the decorators with higher dp ratios. For crisper graphics, increase the sprite sheet's pixel size at the edges and lower the rendered edge size number correspondingly.
 
 
 
 
+### Gradient decorator
+
+A `gradient` decorator has been implemented with support for horizontal and vertical color gradients (thanks to @viciious). Example usage:
+
+```CSS
+decorator: gradient( direction start-color stop-color );
+
+direction: horizontal|vertical;
+start-color: #ff00ff;
+stop-color: #00ff00;
+```
+
+
+### Tiled decorators orientation
+
+The orientation of each tile in the tiled decorators, `image`, `tiled-horizontal`, `tiled-vertical`, and `tiled-box`, can be rotated and flipped (thanks to @viciious). The new keywords are:
+```
+none, rotate-90, rotate-180, rotate-270, flip-horizontal, flip-vertical
+```
+
+Example usage:
+
+```CSS
+decorator: tiled-horizontal( header-l, header-c, header-l flip-horizontal );
+```
+
+
 ### Font-effects
 ### Font-effects
 
 
 The new RCSS `font-effect` property replaces the old font-effect declarations in libRocket. A font-effect is declared similar to a decorator, by the name of the font-effect type and its properties in parenthesis. Some examples follow.
 The new RCSS `font-effect` property replaces the old font-effect declarations in libRocket. A font-effect is declared similar to a decorator, by the name of the font-effect type and its properties in parenthesis. Some examples follow.
@@ -301,10 +328,23 @@ enum class FocusFlag { None, Document, Keep, Auto };
 ```
 ```
 
 
 
 
+### Font engine and interface
+
+The RmlUi font engine has seen a major overhaul.
+
+- The default font engine has been abstracted away, thereby allowing users to implement their own font engine (thanks to @viciious). See `FontEngineInterface.h` and the CMake flag `NO_FONT_INTERFACE_DEFAULT` for details.
+- `font-charset` RCSS property is gone: The font interface now loads new characters as needed. Fallback fonts can be set so that unknown characters are loaded from them.
+- The API and internals are now using UTF-8 strings directly, the old UCS-2 strings are ditched completely. All `String`s in RmlUi should be considered as encoded in UTF-8.
+- Text string are no longer limited to 16 bit code points, thus grayscale emojis are supported, have a look at the `demo` sample for some examples.
+- The internals of the default font engine has had a major overhaul, simplifying a lot of code, and removing the BitmapFont provider.
+- Instead, a custom font engine interface has been implemented for bitmap fonts in the `bitmapfont` sample, serving as a quick example of how to create your own font interface. The sample should work even without the FreeType dependency.
+
+
 ### CMake options
 ### CMake options
 
 
-Two new CMake options added.
+Three new CMake options added.
 
 
+- `NO_FONT_INTERFACE_DEFAULT` removes the default font engine, thereby allowing users to completely remove the FreeType dependency. If set, a custom font engine must be created and set through `Rml::Core::SetFontEngineInterface` before initialization. See the `bitmapfont` sample for an example implementation of a custom font engine.
 - `NO_THIRDPARTY_CONTAINERS`: RmlUi now comes bundled with some third-party container libraries for improved performance. For users that would rather use the `std` counter-parts, this option is available. The option replaces the containers via a preprocessor definition. If the library is compiled with this option, then users of the library *must* specify `#define RMLUI_NO_THIRDPARTY_CONTAINERS` before including the library.
 - `NO_THIRDPARTY_CONTAINERS`: RmlUi now comes bundled with some third-party container libraries for improved performance. For users that would rather use the `std` counter-parts, this option is available. The option replaces the containers via a preprocessor definition. If the library is compiled with this option, then users of the library *must* specify `#define RMLUI_NO_THIRDPARTY_CONTAINERS` before including the library.
 - `ENABLE_TRACY_PROFILING`: RmlUi has parts of the library tagged with markers for profiling with [Tracy Profiler](https://bitbucket.org/wolfpld/tracy/src/master/). This enables a visual inspection of bottlenecks and slowdowns on individual frames. To compile the library with profiling support, add the Tracy Profiler library to `/Dependencies/tracy/`, enable this option, and compile.  Follow the Tracy Profiler instructions to build and connect the separate viewer. As users may want to only use profiling for specific compilation targets, then instead one can `#define RMLUI_ENABLE_PROFILING` for the given target.
 - `ENABLE_TRACY_PROFILING`: RmlUi has parts of the library tagged with markers for profiling with [Tracy Profiler](https://bitbucket.org/wolfpld/tracy/src/master/). This enables a visual inspection of bottlenecks and slowdowns on individual frames. To compile the library with profiling support, add the Tracy Profiler library to `/Dependencies/tracy/`, enable this option, and compile.  Follow the Tracy Profiler instructions to build and connect the separate viewer. As users may want to only use profiling for specific compilation targets, then instead one can `#define RMLUI_ENABLE_PROFILING` for the given target.
 
 
@@ -322,7 +362,7 @@ Two new CMake options added.
 
 
 Breaking changes since RmlUi v2.0.
 Breaking changes since RmlUi v2.0.
 
 
-- Rml::Core::String has been replaced by std::string, thus, interfacing with the library now requires you to change your string types. This change was motivated by a small performance gain, additionally, it should make it easier to interface with the library especially for users already using std::string in their codebase. Similarly, Rml::Core::WString is now an alias for std::wstring.
+- Rml::Core::String has been replaced by std::string, thus, interfacing with the library now requires you to change your string types. This change was motivated by a small performance gain, additionally, it should make it easier to interface with the library especially for users already using std::string in their codebase. Furthermore, strings should be considered as encoded in UTF-8.
 - To load fonts, use `Rml::Core::LoadFontFace` instead of `Rml::Core::FontDatabase::LoadFontFace`.
 - To load fonts, use `Rml::Core::LoadFontFace` instead of `Rml::Core::FontDatabase::LoadFontFace`.
 - Querying the property of an element for size, position and similar may not work as expected right after changes to the document or style. This change is made for performance reasons, see the description under *performance* for reasoning and a workaround.
 - Querying the property of an element for size, position and similar may not work as expected right after changes to the document or style. This change is made for performance reasons, see the description under *performance* for reasoning and a workaround.
 - The Controls::DataGrid "min-rows" property has been removed.
 - The Controls::DataGrid "min-rows" property has been removed.