FontFaceLayer.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * This source file is part of libRocket, the HTML/CSS Interface Middleware
  3. *
  4. * For the latest information, see http://www.librocket.com
  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 ROCKETCOREBITMAPFONTFACELAYER_H
  28. #define ROCKETCOREBITMAPFONTFACELAYER_H
  29. #include <Rocket/Core/Header.h>
  30. #include <Rocket/Core/FontGlyph.h>
  31. #include <Rocket/Core/Geometry.h>
  32. #include <Rocket/Core/GeometryUtilities.h>
  33. #include <Rocket/Core/String.h>
  34. #include "../FontFaceLayer.h"
  35. namespace Rocket {
  36. namespace Core {
  37. class TextureLayout;
  38. namespace BitmapFont {
  39. /**
  40. A textured layer stored as part of a font face handle. Each handle will have at least a base
  41. layer for the standard font. Further layers can be added to allow to rendering of text effects.
  42. @author Peter Curry
  43. */
  44. class FontFaceLayer : public Rocket::Core::FontFaceLayer
  45. {
  46. public:
  47. FontFaceLayer();
  48. virtual ~FontFaceLayer();
  49. /// Generates the character and texture data for the layer.
  50. /// @param[in] handle The handle generating this layer.
  51. /// @param[in] effect The effect to initialise the layer with.
  52. /// @param[in] clone The layer to optionally clone geometry and texture data from.
  53. /// @param[in] deep_clone If true, the clones geometry will be completely cloned and the effect will have no option to affect even the glyph origins.
  54. /// @return True if the layer was generated successfully, false if not.
  55. virtual bool Initialise(const FontFaceHandle* handle, FontEffect* effect = NULL, const Rocket::Core::FontFaceLayer* clone = NULL, bool deep_clone = false);
  56. /// Generates the texture data for a layer (for the texture database).
  57. /// @param[out] texture_data The pointer to be set to the generated texture data.
  58. /// @param[out] texture_dimensions The dimensions of the texture.
  59. /// @param[in] glyphs The glyphs required by the font face handle.
  60. /// @param[in] texture_id The index of the texture within the layer to generate.
  61. virtual bool GenerateTexture(const byte*& texture_data, Vector2i& texture_dimensions, int texture_id);
  62. };
  63. }
  64. }
  65. }
  66. #endif