FontEngineInterfaceDefault.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * This source file is part of RmlUi, the HTML/CSS Interface Middleware
  3. *
  4. * For the latest information, see http://github.com/mikke89/RmlUi
  5. *
  6. * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documentation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in
  16. * all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. * THE SOFTWARE.
  25. *
  26. */
  27. #ifndef RMLUICOREFONTENGINEINTERFACEDEFAULT_H
  28. #define RMLUICOREFONTENGINEINTERFACEDEFAULT_H
  29. #include "../../Include/RmlUi/Core/FontEngineInterface.h"
  30. namespace Rml {
  31. namespace Core {
  32. class RMLUICORE_API FontEngineInterfaceDefault : public FontEngineInterface
  33. {
  34. public:
  35. FontEngineInterfaceDefault();
  36. virtual ~FontEngineInterfaceDefault();
  37. /// Adds a new font face to the database. The face's family, style and weight will be determined from the face itself.
  38. bool LoadFontFace(const String& file_name) override;
  39. /// Returns a handle to a font face that can be used to position and render text. This will return the closest match
  40. /// it can find, but in the event a font family is requested that does not exist, NULL will be returned instead of a
  41. /// valid handle.
  42. FontFaceHandle GetFontFaceHandle(const String& family, Style::FontStyle style, Style::FontWeight weight, int size) override;
  43. /// Generates, if required, the layer configuration for a given array of font effects.
  44. int GenerateLayerConfiguration(FontFaceHandle, const FontEffectList& font_effects) override;
  45. /// Returns the average advance of all glyphs in this font face.
  46. int GetCharacterWidth(FontFaceHandle) override;
  47. /// Returns the point size of this font face.
  48. int GetSize(FontFaceHandle) override;
  49. /// Returns the pixel height of a lower-case x in this font face.
  50. int GetXHeight(FontFaceHandle) override;
  51. /// Returns the default height between this font face's baselines.
  52. int GetLineHeight(FontFaceHandle) override;
  53. /// Returns the font's baseline, as a pixel offset from the bottom of the font.
  54. int GetBaseline(FontFaceHandle) override;
  55. /// Returns the font's underline, as a pixel offset from the bottom of the font.
  56. float GetUnderline(FontFaceHandle, float* thickness) override;
  57. /// Returns the width a string will take up if rendered with this handle.
  58. int GetStringWidth(FontFaceHandle, const String& string, CodePoint prior_character) override;
  59. /// Generates the geometry required to render a single line of text.
  60. int GenerateString(FontFaceHandle, GeometryList& geometry, const String& string, const Vector2f& position, const Colourb& colour, int layer_configuration) override;
  61. int GetVersion(FontFaceHandle handle) override;
  62. };
  63. }
  64. }
  65. #endif