MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / _shape

Method _shape

modules/gui/gui/src/backend/text_server/text_line.cpp:40–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void TextLine::_shape()
41{
42 // When a shaped text is invalidated by an external source, we want to reshape it.
43 if (!TS->shaped_text_is_ready(rid))
44 {
45 dirty = true;
46 }
47
48 if (dirty)
49 {
50 if (!tab_stops.is_empty())
51 {
52 TS->shaped_text_tab_align(rid, tab_stops);
53 }
54
55 BitField<TextServer::TextOverrunFlag> overrun_flags = TextServer::OVERRUN_NO_TRIM;
56 if (overrun_behavior != TextServer::OVERRUN_NO_TRIMMING)
57 {
58 switch (overrun_behavior)
59 {
60 case TextServer::OVERRUN_TRIM_WORD_ELLIPSIS:
61 overrun_flags.set_flag(TextServer::OVERRUN_TRIM);
62 overrun_flags.set_flag(TextServer::OVERRUN_TRIM_WORD_ONLY);
63 overrun_flags.set_flag(TextServer::OVERRUN_ADD_ELLIPSIS);
64 break;
65 case TextServer::OVERRUN_TRIM_ELLIPSIS:
66 overrun_flags.set_flag(TextServer::OVERRUN_TRIM);
67 overrun_flags.set_flag(TextServer::OVERRUN_ADD_ELLIPSIS);
68 break;
69 case TextServer::OVERRUN_TRIM_WORD:
70 overrun_flags.set_flag(TextServer::OVERRUN_TRIM);
71 overrun_flags.set_flag(TextServer::OVERRUN_TRIM_WORD_ONLY);
72 break;
73 case TextServer::OVERRUN_TRIM_CHAR:
74 overrun_flags.set_flag(TextServer::OVERRUN_TRIM);
75 break;
76 case TextServer::OVERRUN_NO_TRIMMING:
77 break;
78 }
79
80 if (alignment == HORIZONTAL_ALIGNMENT_FILL)
81 {
82 TS->shaped_text_fit_to_width(rid, width, flags);
83 overrun_flags.set_flag(TextServer::OVERRUN_JUSTIFICATION_AWARE);
84 TS->shaped_text_overrun_trim_to_width(rid, width, overrun_flags);
85 }
86 else
87 {
88 TS->shaped_text_overrun_trim_to_width(rid, width, overrun_flags);
89 }
90 }
91 else if (alignment == HORIZONTAL_ALIGNMENT_FILL)
92 {
93 TS->shaped_text_fit_to_width(rid, width, flags);
94 }
95 dirty = false;
96 }
97}

Callers 10

resize_objectMethod · 0.80
get_sizeMethod · 0.80
get_line_ascentMethod · 0.80
get_line_descentMethod · 0.80
get_line_widthMethod · 0.80
drawMethod · 0.80
draw_outlineMethod · 0.80
hit_testMethod · 0.80

Calls 2

set_flagMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected