|
|
@@ -41,13 +41,13 @@ public:
|
|
|
FontEngineInterface();
|
|
|
virtual ~FontEngineInterface();
|
|
|
|
|
|
- /// Called by the RmlUi when it wants to load a font face from file.
|
|
|
+ /// Called by RmlUi when it wants to load a font face from file.
|
|
|
/// @param[in] file_name The file to load the face from.
|
|
|
/// @param[in] fallback_face True to use this font face for unknown characters in other font faces.
|
|
|
/// @return True if the face was loaded successfully, false otherwise.
|
|
|
virtual bool LoadFontFace(const String& file_name, bool fallback_face);
|
|
|
|
|
|
- /// Called by the RmlUi when it wants to load a font face from memory, registered using the provided family, style, and weight.
|
|
|
+ /// Called by RmlUi when it wants to load a font face from memory, registered using the provided family, style, and weight.
|
|
|
/// @param[in] data A pointer to the data.
|
|
|
/// @param[in] data_size Size of the data in bytes.
|
|
|
/// @param[in] family The family to register the font as.
|
|
|
@@ -58,30 +58,22 @@ public:
|
|
|
/// Note: The debugger plugin will load its embedded font faces through this method using the family name 'rmlui-debugger-font'.
|
|
|
virtual bool LoadFontFace(const byte* data, int data_size, const String& family, Style::FontStyle style, Style::FontWeight weight, bool fallback_face);
|
|
|
|
|
|
- /// Called by the RmlUi when a font configuration is resolved for an element. Should return a handle that
|
|
|
- /// can later be used to resolve properties of the face, and generate strings which can later be rendered.
|
|
|
+ /// Called by RmlUi when a font configuration is resolved for an element. Should return a handle that
|
|
|
+ /// can later be used to resolve properties of the face, and generate string geometry to be rendered.
|
|
|
/// @param[in] family The family of the desired font handle.
|
|
|
/// @param[in] style The style of the desired font handle.
|
|
|
/// @param[in] weight The weight of the desired font handle.
|
|
|
- /// @param[in] size The size of desired handle, in points. // TODO: Pixels?
|
|
|
+ /// @param[in] size The size of desired handle, in points.
|
|
|
/// @return A valid handle if a matching (or closely matching) font face was found, NULL otherwise.
|
|
|
virtual FontFaceHandle GetFontFaceHandle(const String& family, Style::FontStyle style, Style::FontWeight weight, int size);
|
|
|
|
|
|
- /// Called by RmlUi when it wants to configure the layers such that font effects can be applied.
|
|
|
- /// If font effects are not needed, it should return zero.
|
|
|
+ /// Called by RmlUi when a list of font effects is resolved for an element with a given font face.
|
|
|
/// @param[in] handle The font handle.
|
|
|
/// @param[in] font_effects The list of font effects to generate the configuration for.
|
|
|
- /// @return The index to use when generating geometry using this configuration.
|
|
|
- // TODO: Should return a handle.
|
|
|
- virtual int GenerateLayerConfiguration(FontFaceHandle handle, const FontEffectList &font_effects);
|
|
|
+ /// @return A handle to the prepared font effects which will be used when generating geometry for a string.
|
|
|
+ virtual FontEffectsHandle PrepareFontEffects(FontFaceHandle handle, const FontEffectList &font_effects);
|
|
|
|
|
|
- /// Should return the average advance of all glyphs in this font face.
|
|
|
- /// @param[in] handle The font handle.
|
|
|
- /// @return An approximate width of the characters in this font face.
|
|
|
- // TODO: Not used, remove?
|
|
|
- virtual int GetCharacterWidth(FontFaceHandle handle);
|
|
|
-
|
|
|
- /// Should returns the point size of this font face.
|
|
|
+ /// Should return the point size of this font face.
|
|
|
/// @param[in] handle The font handle.
|
|
|
/// @return The face's point size.
|
|
|
virtual int GetSize(FontFaceHandle handle);
|
|
|
@@ -101,9 +93,9 @@ public:
|
|
|
|
|
|
/// Should return the font's underline, as a pixel offset from the bottom of the font.
|
|
|
/// @param[in] handle The font handle.
|
|
|
- /// @return The font's underline thickness.
|
|
|
- // TODO: Thickness vs Return value? Pointer?
|
|
|
- virtual float GetUnderline(FontFaceHandle handle, float *thickness);
|
|
|
+ /// @param[out] thickness The font's underline thickness in pixels.
|
|
|
+ /// @return The underline pixel offset.
|
|
|
+ virtual float GetUnderline(FontFaceHandle handle, float &thickness);
|
|
|
|
|
|
/// Called by RmlUi when it wants to retrieve the width of a string when rendered with this handle.
|
|
|
/// @param[in] handle The font handle.
|
|
|
@@ -113,20 +105,20 @@ public:
|
|
|
virtual int GetStringWidth(FontFaceHandle handle, const String& string, CodePoint prior_character = CodePoint::Null);
|
|
|
|
|
|
/// Called by RmlUi when it wants to retrieve the geometry required to render a single line of text.
|
|
|
- /// @param[in] handle The font handle.
|
|
|
- /// @param[out] geometry An array of geometries to generate the geometry into.
|
|
|
- /// @param[in] handle The font handle.
|
|
|
+ /// @param[in] face_handle The font handle.
|
|
|
+ /// @param[in] font_effects_handle The handle to the prepared font effects for which the geometry should be generated.
|
|
|
/// @param[in] string The string to render.
|
|
|
/// @param[in] position The position of the baseline of the first character to render.
|
|
|
/// @param[in] colour The colour to render the text.
|
|
|
- /// @param[in] layer_configuration The layer for which the geometry should be generated.
|
|
|
+ /// @param[out] geometry An array of geometries to generate the geometry into.
|
|
|
/// @return The width, in pixels, of the string geometry.
|
|
|
- // TODO: Layer configuration should be a handle. Reorder arguments to take the handles first, geometry last/first.
|
|
|
- virtual int GenerateString(FontFaceHandle handle, GeometryList& geometry, const String& string, const Vector2f& position, const Colourb& colour, int layer_configuration);
|
|
|
+ virtual int GenerateString(FontFaceHandle face_handle, FontEffectsHandle font_effects_handle, const String& string, const Vector2f& position, const Colourb& colour, GeometryList& geometry);
|
|
|
|
|
|
- /// Should return a new value whenever the geometry need to be re-generated.
|
|
|
+ /// 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.
|
|
|
+ /// @param[in] face_handle The font handle.
|
|
|
+ /// @return The version required for using the geometry.
|
|
|
virtual int GetVersion(FontFaceHandle handle);
|
|
|
-
|
|
|
};
|
|
|
|
|
|
}
|