text_server_dummy.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /**************************************************************************/
  2. /* text_server_dummy.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef TEXT_SERVER_DUMMY_H
  31. #define TEXT_SERVER_DUMMY_H
  32. #include "servers/text/text_server_extension.h"
  33. /*************************************************************************/
  34. class TextServerDummy : public TextServerExtension {
  35. GDCLASS(TextServerDummy, TextServerExtension);
  36. _THREAD_SAFE_CLASS_
  37. public:
  38. virtual bool has_feature(Feature p_feature) const override { return false; }
  39. virtual String get_name() const override { return "Dummy"; }
  40. virtual int64_t get_features() const override { return 0; }
  41. virtual void free_rid(const RID &p_rid) override {}
  42. virtual bool has(const RID &p_rid) override { return false; }
  43. virtual RID create_font() override { return RID(); }
  44. virtual void font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) override {}
  45. virtual int64_t font_get_fixed_size(const RID &p_font_rid) const override { return 0; }
  46. virtual void font_set_fixed_size_scale_mode(const RID &p_font_rid, TextServer::FixedSizeScaleMode p_fixed_size_scale_mode) override {}
  47. virtual TextServer::FixedSizeScaleMode font_get_fixed_size_scale_mode(const RID &p_font_rid) const override { return FIXED_SIZE_SCALE_DISABLE; }
  48. virtual TypedArray<Vector2i> font_get_size_cache_list(const RID &p_font_rid) const override { return TypedArray<Vector2i>(); }
  49. virtual void font_clear_size_cache(const RID &p_font_rid) override {}
  50. virtual void font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) override {}
  51. virtual void font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) override {}
  52. virtual double font_get_ascent(const RID &p_font_rid, int64_t p_size) const override { return 0; }
  53. virtual void font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) override {}
  54. virtual double font_get_descent(const RID &p_font_rid, int64_t p_size) const override { return 0; }
  55. virtual void font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) override {}
  56. virtual double font_get_underline_position(const RID &p_font_rid, int64_t p_size) const override { return 0; }
  57. virtual void font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) override {}
  58. virtual double font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const override { return 0; }
  59. virtual void font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) override {}
  60. virtual double font_get_scale(const RID &p_font_rid, int64_t p_size) const override { return 0; }
  61. virtual int64_t font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const override { return 0; }
  62. virtual void font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) override {}
  63. virtual void font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) override {}
  64. virtual void font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref<Image> &p_image) override {}
  65. virtual Ref<Image> font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const override { return Ref<Image>(); }
  66. virtual PackedInt32Array font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const override { return PackedInt32Array(); }
  67. virtual void font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) override {}
  68. virtual void font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) override {}
  69. virtual Vector2 font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const override { return Vector2(); }
  70. virtual void font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) override {}
  71. virtual Vector2 font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Vector2(); }
  72. virtual void font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) override {}
  73. virtual Vector2 font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Vector2(); }
  74. virtual void font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) override {}
  75. virtual Rect2 font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Rect2(); }
  76. virtual void font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) override {}
  77. virtual int64_t font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return 0; }
  78. virtual void font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) override {}
  79. virtual RID font_get_glyph_texture_rid(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return RID(); }
  80. virtual Size2 font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Size2(); }
  81. virtual int64_t font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector) const override { return 0; }
  82. virtual int64_t font_get_char_from_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_glyph_index) const override { return 0; }
  83. virtual bool font_has_char(const RID &p_font_rid, int64_t p_char) const override { return false; }
  84. virtual String font_get_supported_chars(const RID &p_font_rid) const override { return String(); }
  85. virtual PackedInt32Array font_get_supported_glyphs(const RID &p_font_rid) const override { return PackedInt32Array(); }
  86. virtual void font_draw_glyph(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const override {}
  87. virtual void font_draw_glyph_outline(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, int64_t p_outline_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const override {}
  88. virtual RID create_shaped_text(TextServer::Direction p_direction, TextServer::Orientation p_orientation) override { return RID(); }
  89. virtual void shaped_text_clear(const RID &p_shaped) override {}
  90. virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) override { return false; }
  91. virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length, double p_baseline) override { return false; }
  92. virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, double p_baseline) override { return false; }
  93. virtual int64_t shaped_get_span_count(const RID &p_shaped) const override { return 0; }
  94. virtual Variant shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const override { return Variant(); }
  95. virtual void shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) override {}
  96. virtual RID shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const override { return RID(); }
  97. virtual RID shaped_text_get_parent(const RID &p_shaped) const override { return RID(); }
  98. virtual bool shaped_text_shape(const RID &p_shaped) override { return false; }
  99. virtual bool shaped_text_is_ready(const RID &p_shaped) const override { return false; }
  100. virtual const Glyph *shaped_text_get_glyphs(const RID &p_shaped) const override { return nullptr; }
  101. virtual const Glyph *shaped_text_sort_logical(const RID &p_shaped) override { return nullptr; }
  102. virtual int64_t shaped_text_get_glyph_count(const RID &p_shaped) const override { return 0; }
  103. virtual Vector2i shaped_text_get_range(const RID &p_shaped) const override { return Vector2i(); }
  104. virtual int64_t shaped_text_get_trim_pos(const RID &p_shaped) const override { return -1; }
  105. virtual int64_t shaped_text_get_ellipsis_pos(const RID &p_shaped) const override { return -1; }
  106. virtual const Glyph *shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const override { return nullptr; }
  107. virtual int64_t shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const override { return -1; }
  108. virtual Array shaped_text_get_objects(const RID &p_shaped) const override { return Array(); }
  109. virtual Rect2 shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const override { return Rect2(); }
  110. virtual Vector2i shaped_text_get_object_range(const RID &p_shaped, const Variant &p_key) const override { return Vector2i(); }
  111. virtual int64_t shaped_text_get_object_glyph(const RID &p_shaped, const Variant &p_key) const override { return -1; }
  112. virtual Size2 shaped_text_get_size(const RID &p_shaped) const override { return Size2(); }
  113. virtual double shaped_text_get_ascent(const RID &p_shaped) const override { return 0; }
  114. virtual double shaped_text_get_descent(const RID &p_shaped) const override { return 0; }
  115. virtual double shaped_text_get_width(const RID &p_shaped) const override { return 0; }
  116. virtual double shaped_text_get_underline_position(const RID &p_shaped) const override { return 0; }
  117. virtual double shaped_text_get_underline_thickness(const RID &p_shaped) const override { return 0; }
  118. };
  119. #endif // TEXT_SERVER_DUMMY_H