feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEXT_SERVER_FB_H
|
||||
#define TEXT_SERVER_FB_H
|
||||
#pragma once
|
||||
|
||||
/*************************************************************************/
|
||||
/* Fallback Text Server provides simplified TS functionality, without */
|
||||
|
|
@ -219,6 +218,7 @@ class TextServerFallback : public TextServerExtension {
|
|||
Rect2 rect;
|
||||
Rect2 uv_rect;
|
||||
Vector2 advance;
|
||||
bool from_svg = false;
|
||||
};
|
||||
|
||||
struct FontForSizeFallback {
|
||||
|
|
@ -268,6 +268,7 @@ class TextServerFallback : public TextServerExtension {
|
|||
int fixed_size = 0;
|
||||
bool force_autohinter = false;
|
||||
bool allow_system_fallback = true;
|
||||
bool modulate_color_glyphs = false;
|
||||
TextServer::Hinting hinting = TextServer::HINTING_LIGHT;
|
||||
TextServer::SubpixelPositioning subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_AUTO;
|
||||
bool keep_rounding_remainders = true;
|
||||
|
|
@ -341,7 +342,7 @@ class TextServerFallback : public TextServerExtension {
|
|||
}
|
||||
|
||||
_FORCE_INLINE_ int _font_get_weight_by_name(const String &p_sty_name) const {
|
||||
String sty_name = p_sty_name.replace(" ", "").replace("-", "");
|
||||
String sty_name = p_sty_name.remove_chars(" -");
|
||||
if (sty_name.contains("thin") || sty_name.contains("hairline")) {
|
||||
return 100;
|
||||
} else if (sty_name.contains("extralight") || sty_name.contains("ultralight")) {
|
||||
|
|
@ -368,7 +369,7 @@ class TextServerFallback : public TextServerExtension {
|
|||
return 400;
|
||||
}
|
||||
_FORCE_INLINE_ int _font_get_stretch_by_name(const String &p_sty_name) const {
|
||||
String sty_name = p_sty_name.replace(" ", "").replace("-", "");
|
||||
String sty_name = p_sty_name.remove_chars(" -");
|
||||
if (sty_name.contains("ultracondensed")) {
|
||||
return 50;
|
||||
} else if (sty_name.contains("extracondensed")) {
|
||||
|
|
@ -399,6 +400,13 @@ class TextServerFallback : public TextServerExtension {
|
|||
Vector<Glyph> ellipsis_glyph_buf;
|
||||
};
|
||||
|
||||
struct TextRun {
|
||||
Vector2i range;
|
||||
RID font_rid;
|
||||
int font_size = 0;
|
||||
int64_t span_index = -1;
|
||||
};
|
||||
|
||||
struct ShapedTextDataFallback {
|
||||
Mutex mutex;
|
||||
|
||||
|
|
@ -430,6 +438,9 @@ class TextServerFallback : public TextServerExtension {
|
|||
int first_span = 0; // First span in the parent ShapedTextData.
|
||||
int last_span = 0;
|
||||
|
||||
Vector<TextRun> runs;
|
||||
bool runs_dirty = true;
|
||||
|
||||
struct EmbeddedObject {
|
||||
int start = -1;
|
||||
int end = -1;
|
||||
|
|
@ -574,6 +585,7 @@ class TextServerFallback : public TextServerExtension {
|
|||
mutable HashMap<SystemFontKey, SystemFontCache, SystemFontKeyHasher> system_fonts;
|
||||
mutable HashMap<String, PackedByteArray> system_font_data;
|
||||
|
||||
void _generate_runs(ShapedTextDataFallback *p_sd) const;
|
||||
void _realign(ShapedTextDataFallback *p_sd) const;
|
||||
_FORCE_INLINE_ RID _find_sys_font_for_text(const RID &p_fdef, const String &p_script_code, const String &p_language, const String &p_text);
|
||||
|
||||
|
|
@ -662,6 +674,9 @@ public:
|
|||
MODBIND2(font_set_force_autohinter, const RID &, bool);
|
||||
MODBIND1RC(bool, font_is_force_autohinter, const RID &);
|
||||
|
||||
MODBIND2(font_set_modulate_color_glyphs, const RID &, bool);
|
||||
MODBIND1RC(bool, font_is_modulate_color_glyphs, const RID &);
|
||||
|
||||
MODBIND2(font_set_subpixel_positioning, const RID &, SubpixelPositioning);
|
||||
MODBIND1RC(SubpixelPositioning, font_get_subpixel_positioning, const RID &);
|
||||
|
||||
|
|
@ -816,12 +831,24 @@ public:
|
|||
MODBIND7R(bool, shaped_text_add_string, const RID &, const String &, const TypedArray<RID> &, int64_t, const Dictionary &, const String &, const Variant &);
|
||||
MODBIND6R(bool, shaped_text_add_object, const RID &, const Variant &, const Size2 &, InlineAlignment, int64_t, double);
|
||||
MODBIND5R(bool, shaped_text_resize_object, const RID &, const Variant &, const Size2 &, InlineAlignment, double);
|
||||
MODBIND1RC(String, shaped_get_text, const RID &);
|
||||
|
||||
MODBIND1RC(int64_t, shaped_get_span_count, const RID &);
|
||||
MODBIND2RC(Variant, shaped_get_span_meta, const RID &, int64_t);
|
||||
MODBIND2RC(Variant, shaped_get_span_embedded_object, const RID &, int64_t);
|
||||
MODBIND2RC(String, shaped_get_span_text, const RID &, int64_t);
|
||||
MODBIND2RC(Variant, shaped_get_span_object, const RID &, int64_t);
|
||||
MODBIND5(shaped_set_span_update_font, const RID &, int64_t, const TypedArray<RID> &, int64_t, const Dictionary &);
|
||||
|
||||
MODBIND1RC(int64_t, shaped_get_run_count, const RID &);
|
||||
MODBIND2RC(String, shaped_get_run_text, const RID &, int64_t);
|
||||
MODBIND2RC(Vector2i, shaped_get_run_range, const RID &, int64_t);
|
||||
MODBIND2RC(RID, shaped_get_run_font_rid, const RID &, int64_t);
|
||||
MODBIND2RC(int, shaped_get_run_font_size, const RID &, int64_t);
|
||||
MODBIND2RC(String, shaped_get_run_language, const RID &, int64_t);
|
||||
MODBIND2RC(Direction, shaped_get_run_direction, const RID &, int64_t);
|
||||
MODBIND2RC(Variant, shaped_get_run_object, const RID &, int64_t);
|
||||
|
||||
MODBIND3RC(RID, shaped_text_substr, const RID &, int64_t, int64_t);
|
||||
MODBIND1RC(RID, shaped_text_get_parent, const RID &);
|
||||
|
||||
|
|
@ -872,5 +899,3 @@ public:
|
|||
TextServerFallback();
|
||||
~TextServerFallback();
|
||||
};
|
||||
|
||||
#endif // TEXT_SERVER_FB_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue