2023-01-05 13:25:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*  label.cpp                                                             */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                         This file is part of:                          */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                             GODOT ENGINE                               */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                        https://godotengine.org                         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Permission is hereby granted, free of charge, to any person obtaining  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* a copy of this software and associated documentation files (the        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* "Software"), to deal in the Software without restriction, including    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* without limitation the rights to use, copy, modify, merge, publish,    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* distribute, sublicense, and/or sell copies of the Software, and to     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* permit persons to whom the Software is furnished to do so, subject to  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* the following conditions:                                              */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* The above copyright notice and this permission notice shall be         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* included in all copies or substantial portions of the Software.        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
									
										
										
										
											2018-01-05 00:50:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "label.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-05-12 17:01:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-09 14:09:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/container.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-09-08 21:00:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/theme/theme_db.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "servers/text_server.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_autowrap_mode ( TextServer : : AutowrapMode  p_mode )  {  
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( autowrap_mode  = =  p_mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-10 14:40:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									autowrap_mode  =  p_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										para . lines_dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-09 14:09:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-10 14:40:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( clip  | |  overrun_behavior  ! =  TextServer : : OVERRUN_NO_TRIMMING )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 14:02:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										update_minimum_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-10 14:40:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TextServer : : AutowrapMode  Label : : get_autowrap_mode ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2021-07-04 16:43:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  autowrap_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:57:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_autowrap_trim_flags ( BitField < TextServer : : LineBreakFlag >  p_flags )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( autowrap_flags_trim  = =  ( p_flags  &  TextServer : : BREAK_TRIM_MASK ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									autowrap_flags_trim  =  p_flags  &  TextServer : : BREAK_TRIM_MASK ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										para . lines_dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( clip  | |  overrun_behavior  ! =  TextServer : : OVERRUN_NO_TRIMMING )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										update_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								BitField < TextServer : : LineBreakFlag >  Label : : get_autowrap_trim_flags ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  autowrap_flags_trim ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 11:22:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_justification_flags ( BitField < TextServer : : JustificationFlag >  p_flags )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( jst_flags  = =  p_flags )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									jst_flags  =  p_flags ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										para . lines_dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 11:22:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								BitField < TextServer : : JustificationFlag >  Label : : get_justification_flags ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  jst_flags ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  Label : : set_uppercase ( bool  p_uppercase )  {  
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( uppercase  = =  p_uppercase )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uppercase  =  p_uppercase ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									text_dirty  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_accessibility_update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								bool  Label : : is_uppercase ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  uppercase ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  Label : : get_line_height ( int  p_line )  const  {  
						 
					
						
							
								
									
										
										
										
											2022-08-31 15:02:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Font >  font  =  ( settings . is_valid ( )  & &  settings - > get_font ( ) . is_valid ( ) )  ?  settings - > get_font ( )  :  theme_cache . font ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  font_size  =  settings . is_valid ( )  ?  settings - > get_font_size ( )  :  theme_cache . font_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_h  =  font - > get_height ( font_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_line  > =  0  & &  p_line  <  total_line_count )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 17:59:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RID  rid  =  get_line_rid ( p_line ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										double  asc  =  TS - > shaped_text_get_ascent ( rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										double  dsc  =  TS - > shaped_text_get_descent ( rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( asc  +  dsc  <  font_h )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											double  diff  =  font_h  -  ( asc  +  dsc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											asc  + =  diff  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											dsc  + =  diff  -  ( diff  /  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  asc  +  dsc ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  if  ( total_line_count  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  h  =  font_h ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( const  Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( const  RID  & line_rid  :  para . lines_rid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												h  =  MAX ( h ,  TS - > shaped_text_get_size ( line_rid ) . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  h ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-17 11:05:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  font - > get_height ( font_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-07-29 21:23:12 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : _shape ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2022-08-31 15:02:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < StyleBox >  style  =  theme_cache . normal_style ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  width  =  ( get_size ( ) . width  -  style - > get_minimum_size ( ) . width ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( text_dirty )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( const  RID  & line_rid  :  para . lines_rid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TS - > free_rid ( line_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											para . lines_rid . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											TS - > free_rid ( para . text_rid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										paragraphs . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  txt  =  ( uppercase )  ?  TS - > string_to_upper ( xl_text ,  language )  :  xl_text ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( visible_chars  > =  0  & &  visible_chars_behavior  = =  TextServer : : VC_CHARS_BEFORE_SHAPING )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											txt  =  txt . substr ( 0 ,  visible_chars ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-20 09:35:24 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  ps  =  paragraph_separator . c_unescape ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Vector < String >  para_text  =  txt . split ( ps ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  start  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( const  String  & str  :  para_text )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Paragraph  para ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											para . text_rid  =  TS - > create_shaped_text ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-07-25 08:17:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											para . text  =  str  +  String : : chr ( 0x200B ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											para . start  =  start ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											start  + =  str . length ( )  +  ps . length ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											paragraphs . push_back ( para ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-16 14:48:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										text_dirty  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 16:43:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									total_line_count  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( para . dirty  | |  font_dirty )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( para . dirty )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TS - > shaped_text_clear ( para . text_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( text_direction  = =  Control : : TEXT_DIRECTION_INHERITED )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TS - > shaped_text_set_direction ( para . text_rid ,  is_layout_rtl ( )  ?  TextServer : : DIRECTION_RTL  :  TextServer : : DIRECTION_LTR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TS - > shaped_text_set_direction ( para . text_rid ,  ( TextServer : : Direction ) text_direction ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Ref < Font >  & font  =  ( settings . is_valid ( )  & &  settings - > get_font ( ) . is_valid ( ) )  ?  settings - > get_font ( )  :  theme_cache . font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  font_size  =  settings . is_valid ( )  ?  settings - > get_font_size ( )  :  theme_cache . font_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ERR_FAIL_COND ( font . is_null ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-06 14:12:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( para . dirty )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TS - > shaped_text_add_string ( para . text_rid ,  para . text ,  font - > get_rids ( ) ,  font_size ,  font - > get_opentype_features ( ) ,  language ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  spans  =  TS - > shaped_get_span_count ( para . text_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  spans ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													TS - > shaped_set_span_update_font ( para . text_rid ,  i ,  font - > get_rids ( ) ,  font_size ,  font - > get_opentype_features ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											TS - > shaped_text_set_bidi_override ( para . text_rid ,  structured_text_parser ( st_parser ,  st_args ,  para . text ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! tab_stops . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TS - > shaped_text_tab_align ( para . text_rid ,  tab_stops ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											para . dirty  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											para . lines_dirty  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-06 14:12:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( para . lines_dirty )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( const  RID  & line_rid  :  para . lines_rid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TS - > free_rid ( line_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											para . lines_rid . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											BitField < TextServer : : LineBreakFlag >  autowrap_flags  =  TextServer : : BREAK_MANDATORY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											switch  ( autowrap_mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  TextServer : : AUTOWRAP_WORD_SMART : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													autowrap_flags  =  TextServer : : BREAK_WORD_BOUND  |  TextServer : : BREAK_ADAPTIVE  |  TextServer : : BREAK_MANDATORY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  TextServer : : AUTOWRAP_WORD : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													autowrap_flags  =  TextServer : : BREAK_WORD_BOUND  |  TextServer : : BREAK_MANDATORY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  TextServer : : AUTOWRAP_ARBITRARY : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													autowrap_flags  =  TextServer : : BREAK_GRAPHEME_BOUND  |  TextServer : : BREAK_MANDATORY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  TextServer : : AUTOWRAP_OFF : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:57:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											autowrap_flags  =  autowrap_flags  |  autowrap_flags_trim ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PackedInt32Array  line_breaks  =  TS - > shaped_text_get_line_breaks ( para . text_rid ,  width ,  0 ,  autowrap_flags ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  line_breaks . size ( ) ;  i  =  i  +  2 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												RID  line  =  TS - > shaped_text_substr ( para . text_rid ,  line_breaks [ i ] ,  line_breaks [ i  +  1 ]  -  line_breaks [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! tab_stops . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													TS - > shaped_text_tab_align ( line ,  tab_stops ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												para . lines_rid . push_back ( line ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-16 14:48:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										total_line_count  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									dirty  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									font_dirty  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 16:43:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( xl_text . length ( )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										minsize  =  Size2 ( 1 ,  get_line_height ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  visible_lines  =  get_visible_line_count ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  lines_hidden  =  visible_lines  >  0  & &  visible_lines  <  total_line_count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  line_index  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-02 07:57:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( autowrap_mode  = =  TextServer : : AUTOWRAP_OFF )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										minsize . width  =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( autowrap_mode  = =  TextServer : : AUTOWRAP_OFF )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( const  RID  & line_rid  :  para . lines_rid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( minsize . width  <  TS - > shaped_text_get_size ( line_rid ) . x )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													minsize . width  =  TS - > shaped_text_get_size ( line_rid ) . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-13 18:46:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( para . lines_dirty )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-09-23 16:08:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BitField < TextServer : : TextOverrunFlag >  overrun_flags  =  TextServer : : get_overrun_flags_from_behavior ( overrun_behavior ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-11 00:09:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Fill after min_size calculation.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-11 00:09:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BitField < TextServer : : JustificationFlag >  line_jst_flags  =  jst_flags ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! tab_stops . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												line_jst_flags . set_flag ( TextServer : : JUSTIFICATION_AFTER_LAST_TAB ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( autowrap_mode  ! =  TextServer : : AUTOWRAP_OFF )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( lines_hidden )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													overrun_flags . set_flag ( TextServer : : OVERRUN_ENFORCE_ELLIPSIS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( horizontal_alignment  = =  HORIZONTAL_ALIGNMENT_FILL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  jst_to_line  =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( para . lines_rid . size ( )  = =  1  & &  line_jst_flags . has_flag ( TextServer : : JUSTIFICATION_DO_NOT_SKIP_SINGLE_LINE ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														jst_to_line  =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( line_jst_flags . has_flag ( TextServer : : JUSTIFICATION_SKIP_LAST_LINE ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															jst_to_line  =  para . lines_rid . size ( )  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( line_jst_flags . has_flag ( TextServer : : JUSTIFICATION_SKIP_LAST_LINE_WITH_VISIBLE_CHARS ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															for  ( int  i  =  para . lines_rid . size ( )  -  1 ;  i  > =  0 ;  i - - )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																if  ( TS - > shaped_text_has_visible_chars ( para . lines_rid [ i ] ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	jst_to_line  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( int  i  =  0 ;  i  <  para . lines_rid . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( i  <  jst_to_line )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															TS - > shaped_text_fit_to_width ( para . lines_rid [ i ] ,  width ,  line_jst_flags ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  if  ( i  = =  ( visible_lines  -  line_index  -  1 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															TS - > shaped_text_set_custom_ellipsis ( para . lines_rid [ i ] ,  ( el_char . length ( )  >  0 )  ?  el_char [ 0 ]  :  0x2026 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															TS - > shaped_text_overrun_trim_to_width ( para . lines_rid [ i ] ,  width ,  overrun_flags ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if  ( lines_hidden  & &  ( visible_lines  -  line_index  -  1  > =  0 )  & &  ( visible_lines  -  line_index  -  1 )  <  para . lines_rid . size ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													TS - > shaped_text_set_custom_ellipsis ( para . lines_rid [ visible_lines  -  line_index  -  1 ] ,  ( el_char . length ( )  >  0 )  ?  el_char [ 0 ]  :  0x2026 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													TS - > shaped_text_overrun_trim_to_width ( para . lines_rid [ visible_lines  -  line_index  -  1 ] ,  width ,  overrun_flags ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Autowrap disabled.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  jst_to_line  =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( para . lines_rid . size ( )  = =  1  & &  line_jst_flags . has_flag ( TextServer : : JUSTIFICATION_DO_NOT_SKIP_SINGLE_LINE ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													jst_to_line  =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 11:22:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-16 14:48:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( line_jst_flags . has_flag ( TextServer : : JUSTIFICATION_SKIP_LAST_LINE ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														jst_to_line  =  para . lines_rid . size ( )  -  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 11:22:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-16 14:48:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( line_jst_flags . has_flag ( TextServer : : JUSTIFICATION_SKIP_LAST_LINE_WITH_VISIBLE_CHARS ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														for  ( int  i  =  para . lines_rid . size ( )  -  1 ;  i  > =  0 ;  i - - )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( TS - > shaped_text_has_visible_chars ( para . lines_rid [ i ] ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 11:22:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																jst_to_line  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  para . lines_rid . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( i  <  jst_to_line  & &  horizontal_alignment  = =  HORIZONTAL_ALIGNMENT_FILL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														TS - > shaped_text_fit_to_width ( para . lines_rid [ i ] ,  width ,  line_jst_flags ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														overrun_flags . set_flag ( TextServer : : OVERRUN_JUSTIFICATION_AWARE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														TS - > shaped_text_set_custom_ellipsis ( para . lines_rid [ i ] ,  ( el_char . length ( )  >  0 )  ?  el_char [ 0 ]  :  0x2026 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														TS - > shaped_text_overrun_trim_to_width ( para . lines_rid [ i ] ,  width ,  overrun_flags ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														TS - > shaped_text_fit_to_width ( para . lines_rid [ i ] ,  width ,  line_jst_flags  |  TextServer : : JUSTIFICATION_CONSTRAIN_ELLIPSIS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														TS - > shaped_text_set_custom_ellipsis ( para . lines_rid [ i ] ,  ( el_char . length ( )  >  0 )  ?  el_char [ 0 ]  :  0x2026 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														TS - > shaped_text_overrun_trim_to_width ( para . lines_rid [ i ] ,  width ,  overrun_flags ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-11 00:09:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 16:43:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											para . lines_dirty  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-06 14:12:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 08:57:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_update_visible ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( autowrap_mode  = =  TextServer : : AUTOWRAP_OFF  | |  ! clip  | |  overrun_behavior  = =  TextServer : : OVERRUN_NO_TRIMMING )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-29 21:23:12 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										const_cast < Label  * > ( this ) - > update_minimum_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-07-29 21:23:12 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : _update_visible ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  line_spacing  =  settings . is_valid ( )  ?  settings - > get_line_spacing ( )  :  theme_cache . line_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  paragraph_spacing  =  settings . is_valid ( )  ?  settings - > get_paragraph_spacing ( )  :  theme_cache . paragraph_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < StyleBox >  style  =  theme_cache . normal_style ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Font >  font  =  ( settings . is_valid ( )  & &  settings - > get_font ( ) . is_valid ( ) )  ?  settings - > get_font ( )  :  theme_cache . font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_size  =  settings . is_valid ( )  ?  settings - > get_font_size ( )  :  theme_cache . font_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_h  =  font - > get_height ( font_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  lines_visible  =  total_line_count ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( max_lines_visible  > =  0  & &  lines_visible  >  max_lines_visible )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										lines_visible  =  max_lines_visible ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									minsize . height  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  last_line  =  MIN ( total_line_count ,  lines_visible  +  lines_skipped ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  line_index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( line_index  +  para . lines_rid . size ( )  < =  lines_skipped )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  start  =  ( line_index  <  lines_skipped )  ?  lines_skipped  -  line_index  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  end  =  ( line_index  +  para . lines_rid . size ( )  <  last_line )  ?  para . lines_rid . size ( )  :  last_line  -  line_index ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( end  < =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  start ;  i  <  end ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 17:59:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												double  asc  =  TS - > shaped_text_get_ascent ( para . lines_rid [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												double  dsc  =  TS - > shaped_text_get_descent ( para . lines_rid [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( asc  +  dsc  <  font_h )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													double  diff  =  font_h  -  ( asc  +  dsc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													asc  + =  diff  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													dsc  + =  diff  -  ( diff  /  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												minsize . height  + =  asc  +  dsc  +  line_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											minsize . height  + =  paragraph_spacing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 08:15:42 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( minsize . height  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										minsize . height  - =  ( line_spacing  +  paragraph_spacing ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 08:15:42 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-28 00:19:51 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								inline  void  draw_glyph ( const  Glyph  & p_gl ,  const  RID  & p_canvas ,  const  Color  & p_font_color ,  const  Vector2  & p_ofs )  {  
						 
					
						
							
								
									
										
										
										
											2021-08-23 14:13:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_gl . font_rid  ! =  RID ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										TS - > font_draw_glyph ( p_gl . font_rid ,  p_canvas ,  p_gl . font_size ,  p_ofs  +  Vector2 ( p_gl . x_off ,  p_gl . y_off ) ,  p_gl . index ,  p_font_color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-26 09:37:47 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  if  ( ( ( p_gl . flags  &  TextServer : : GRAPHEME_IS_VIRTUAL )  ! =  TextServer : : GRAPHEME_IS_VIRTUAL )  & &  ( ( p_gl . flags  &  TextServer : : GRAPHEME_IS_EMBEDDED_OBJECT )  ! =  TextServer : : GRAPHEME_IS_EMBEDDED_OBJECT ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-23 14:13:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										TS - > draw_hex_code_box ( p_canvas ,  p_gl . font_size ,  p_ofs  +  Vector2 ( p_gl . x_off ,  p_gl . y_off ) ,  p_gl . index ,  p_font_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-02 18:38:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								inline  void  draw_glyph_shadow ( const  Glyph  & p_gl ,  const  RID  & p_canvas ,  const  Color  & p_font_shadow_color ,  const  Vector2  & p_ofs ,  const  Vector2  & shadow_ofs )  {  
						 
					
						
							
								
									
										
										
										
											2021-08-11 00:09:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_gl . font_rid  ! =  RID ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-02 18:38:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										TS - > font_draw_glyph ( p_gl . font_rid ,  p_canvas ,  p_gl . font_size ,  p_ofs  +  Vector2 ( p_gl . x_off ,  p_gl . y_off )  +  shadow_ofs ,  p_gl . index ,  p_font_shadow_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-04-02 21:16:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								inline  void  draw_glyph_shadow_outline ( const  Glyph  & p_gl ,  const  RID  & p_canvas ,  const  Color  & p_font_shadow_color ,  const  Vector2  & p_ofs ,  int  p_shadow_outline_size ,  const  Vector2  & shadow_ofs )  {  
						 
					
						
							
								
									
										
										
										
											2025-03-02 18:38:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_gl . font_rid  ! =  RID ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										TS - > font_draw_glyph_outline ( p_gl . font_rid ,  p_canvas ,  p_gl . font_size ,  p_shadow_outline_size ,  p_ofs  +  Vector2 ( p_gl . x_off ,  p_gl . y_off )  +  shadow_ofs ,  p_gl . index ,  p_font_shadow_color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-15 11:24:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-04-02 21:16:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								inline  void  draw_glyph_outline ( const  Glyph  & p_gl ,  const  RID  & p_canvas ,  const  Color  & p_font_outline_color ,  const  Vector2  & p_ofs ,  int  p_outline_size )  {  
						 
					
						
							
								
									
										
										
										
											2024-03-15 11:24:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_gl . font_rid  ! =  RID ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-11 00:09:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( p_font_outline_color . a  ! =  0.0  & &  p_outline_size  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											TS - > font_draw_glyph_outline ( p_gl . font_rid ,  p_canvas ,  p_gl . font_size ,  p_outline_size ,  p_ofs  +  Vector2 ( p_gl . x_off ,  p_gl . y_off ) ,  p_gl . index ,  p_font_outline_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : _ensure_shaped ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( dirty  | |  font_dirty  | |  text_dirty )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-29 21:23:12 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_shape ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( const  Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( para . lines_dirty  | |  para . dirty )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-29 21:23:12 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												_shape ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-29 21:23:12 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								RID  Label : : get_line_rid ( int  p_line )  const  {  
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_line  <  0  | |  p_line  > =  total_line_count )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  RID ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  line_index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( line_index  +  para . lines_rid . size ( )  < =  p_line )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  para . lines_rid [ p_line  -  line_index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  RID ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Rect2  Label : : get_line_rect ( int  p_line )  const  {  
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_line  <  0  | |  p_line  > =  total_line_count )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  Rect2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  line_index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  p  =  0 ;  p  <  paragraphs . size ( ) ;  p + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  Paragraph  & para  =  paragraphs [ p ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( line_index  +  para . lines_rid . size ( )  < =  p_line )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  _get_line_rect ( p ,  p_line  -  line_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  Rect2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Rect2  Label : : _get_line_rect ( int  p_para ,  int  p_line )  const  {  
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Returns a rect providing the line's horizontal offset and total size. To determine the vertical
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// offset, use r_offset and r_line_spacing from get_layout_data.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  rtl  =  TS - > shaped_text_get_inferred_direction ( paragraphs [ p_para ] . text_rid )  = =  TextServer : : DIRECTION_RTL ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  rtl_layout  =  is_layout_rtl ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < StyleBox >  style  =  theme_cache . normal_style ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Font >  font  =  ( settings . is_valid ( )  & &  settings - > get_font ( ) . is_valid ( ) )  ?  settings - > get_font ( )  :  theme_cache . font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_size  =  settings . is_valid ( )  ?  settings - > get_font_size ( )  :  theme_cache . font_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_h  =  font - > get_height ( font_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Size2  size  =  get_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 17:59:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RID  rid  =  paragraphs [ p_para ] . lines_rid [ p_line ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Size2  line_size  =  TS - > shaped_text_get_size ( rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  asc  =  TS - > shaped_text_get_ascent ( rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  dsc  =  TS - > shaped_text_get_descent ( rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( asc  +  dsc  <  font_h )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										double  diff  =  font_h  -  ( asc  +  dsc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										asc  + =  diff  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dsc  + =  diff  -  ( diff  /  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									line_size . y  =  asc  +  dsc ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector2  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( horizontal_alignment )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  HORIZONTAL_ALIGNMENT_FILL : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( rtl  & &  autowrap_mode  ! =  TextServer : : AUTOWRAP_OFF )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												offset . x  =  int ( size . width  -  style - > get_margin ( SIDE_RIGHT )  -  line_size . width ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												offset . x  =  style - > get_offset ( ) . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  HORIZONTAL_ALIGNMENT_LEFT :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( rtl_layout )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												offset . x  =  int ( size . width  -  style - > get_margin ( SIDE_RIGHT )  -  line_size . width ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												offset . x  =  style - > get_offset ( ) . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  HORIZONTAL_ALIGNMENT_CENTER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											offset . x  =  int ( size . width  -  line_size . width )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  HORIZONTAL_ALIGNMENT_RIGHT :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( rtl_layout )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												offset . x  =  style - > get_offset ( ) . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												offset . x  =  int ( size . width  -  style - > get_margin ( SIDE_RIGHT )  -  line_size . width ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  Rect2 ( offset ,  line_size ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  Label : : get_layout_data ( Vector2  & r_offset ,  int  & r_last_line ,  int  & r_line_spacing )  const  {  
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Computes several common parameters involved in laying out and rendering text set to this label.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Only vertical margin is considered in r_offset: use get_line_rect to get the horizontal offset
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// for a given line of text.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Size2  size  =  get_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < StyleBox >  style  =  theme_cache . normal_style ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Font >  font  =  ( settings . is_valid ( )  & &  settings - > get_font ( ) . is_valid ( ) )  ?  settings - > get_font ( )  :  theme_cache . font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_size  =  settings . is_valid ( )  ?  settings - > get_font_size ( )  :  theme_cache . font_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_h  =  font - > get_height ( font_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  line_spacing  =  settings . is_valid ( )  ?  settings - > get_line_spacing ( )  :  theme_cache . line_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  paragraph_spacing  =  settings . is_valid ( )  ?  settings - > get_paragraph_spacing ( )  :  theme_cache . paragraph_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  total_h  =  0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  lines_visible  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Get number of lines to fit to the height.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  line_index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( line_index  +  para . lines_rid . size ( )  < =  lines_skipped )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  start  =  ( line_index  <  lines_skipped )  ?  lines_skipped  -  line_index  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  start ;  i  <  para . lines_rid . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 17:59:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												double  asc  =  TS - > shaped_text_get_ascent ( para . lines_rid [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												double  dsc  =  TS - > shaped_text_get_descent ( para . lines_rid [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( asc  +  dsc  <  font_h )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													double  diff  =  font_h  -  ( asc  +  dsc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													asc  + =  diff  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													dsc  + =  diff  -  ( diff  /  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												total_h  + =  asc  +  dsc  +  line_spacing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( total_h  >  Math : : ceil ( get_size ( ) . height  -  style - > get_minimum_size ( ) . height  +  line_spacing ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												lines_visible + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											total_h  + =  paragraph_spacing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( max_lines_visible  > =  0  & &  lines_visible  >  max_lines_visible )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										lines_visible  =  max_lines_visible ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									r_last_line  =  MIN ( total_line_count ,  lines_visible  +  lines_skipped ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Get real total height.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  total_glyphs  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									total_h  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									line_index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( line_index  +  para . lines_rid . size ( )  < =  lines_skipped )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  start  =  ( line_index  <  lines_skipped )  ?  lines_skipped  -  line_index  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  end  =  ( line_index  +  para . lines_rid . size ( )  <  r_last_line )  ?  para . lines_rid . size ( )  :  r_last_line  -  line_index ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( end  < =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  start ;  i  <  end ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 17:59:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												double  asc  =  TS - > shaped_text_get_ascent ( para . lines_rid [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												double  dsc  =  TS - > shaped_text_get_descent ( para . lines_rid [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( asc  +  dsc  <  font_h )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													double  diff  =  font_h  -  ( asc  +  dsc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													asc  + =  diff  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													dsc  + =  diff  -  ( diff  /  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												total_h  + =  asc  +  dsc  +  line_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												total_glyphs  + =  TS - > shaped_text_get_glyph_count ( para . lines_rid [ i ] )  +  TS - > shaped_text_get_ellipsis_glyph_count ( para . lines_rid [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											total_h  + =  paragraph_spacing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									total_h  + =  style - > get_margin ( SIDE_TOP )  +  style - > get_margin ( SIDE_BOTTOM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  vbegin  =  0 ,  vsep  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( lines_visible  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										switch  ( vertical_alignment )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  VERTICAL_ALIGNMENT_TOP :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Nothing.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  VERTICAL_ALIGNMENT_CENTER :  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												vbegin  =  ( size . y  -  ( total_h  -  line_spacing  -  paragraph_spacing ) )  /  2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												vsep  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  VERTICAL_ALIGNMENT_BOTTOM :  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												vbegin  =  size . y  -  ( total_h  -  line_spacing  -  paragraph_spacing ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												vsep  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  VERTICAL_ALIGNMENT_FILL :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												vbegin  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( lines_visible  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													vsep  =  ( size . y  -  ( total_h  -  line_spacing  -  paragraph_spacing ) )  /  ( lines_visible  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													vsep  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r_offset  =  {  0 ,  style - > get_offset ( ) . y  +  vbegin  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r_line_spacing  =  line_spacing  +  vsep ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  total_glyphs ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-17 19:03:21 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PackedStringArray  Label : : get_configuration_warnings ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PackedStringArray  warnings  =  Control : : get_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-08 15:56:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-09 14:09:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// FIXME: This is not ideal and the sizing model should be fixed,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// but for now we have to warn about this impossible to resolve combination.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// See GH-83546.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( is_inside_tree ( )  & &  get_tree ( ) - > get_edited_scene_root ( )  ! =  this )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// If the Label happens to be the root node of the edited scene, we don't need
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// to check what its parent is. It's going to be some node from the editor tree
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// and it can be a container, but that makes no difference to the user.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Container  * parent_container  =  Object : : cast_to < Container > ( get_parent_control ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( parent_container  & &  autowrap_mode  ! =  TextServer : : AUTOWRAP_OFF  & &  get_custom_minimum_size ( )  = =  Size2 ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											warnings . push_back ( RTR ( " Labels with autowrapping enabled must have a custom minimum size configured to work correctly inside a container. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-08 15:56:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Ensure that the font can render all of the required glyphs.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < Font >  font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( settings . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										font  =  settings - > get_font ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( font . is_null ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										font  =  theme_cache . font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( font . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_ensure_shaped ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( const  Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Glyph  * glyph  =  TS - > shaped_text_get_glyphs ( para . text_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int64_t  glyph_count  =  TS - > shaped_text_get_glyph_count ( para . text_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int64_t  i  =  0 ;  i  <  glyph_count ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( glyph [ i ] . font_rid  = =  RID ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													warnings . push_back ( RTR ( " The current font does not support rendering one or more characters used in this Label's text. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-08 15:56:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  warnings ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  Label : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ACCESSIBILITY_UPDATE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											RID  ae  =  get_accessibility_element ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ERR_FAIL_COND ( ae . is_null ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DisplayServer : : get_singleton ( ) - > accessibility_update_set_role ( ae ,  DisplayServer : : AccessibilityRole : : ROLE_STATIC_TEXT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DisplayServer : : get_singleton ( ) - > accessibility_update_set_value ( ae ,  xl_text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DisplayServer : : get_singleton ( ) - > accessibility_update_set_text_align ( ae ,  horizontal_alignment ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_TRANSLATION_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  new_text  =  atr ( text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( new_text  = =  xl_text )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ;  // Nothing new.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											xl_text  =  new_text ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 20:06:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( visible_ratio  <  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												visible_chars  =  get_total_character_count ( )  *  visible_ratio ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											text_dirty  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-28 17:00:18 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_accessibility_update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-08 15:56:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											update_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-09 16:43:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_LAYOUT_DIRECTION_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-21 10:35:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_DRAW :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( clip )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												RenderingServer : : get_singleton ( ) - > canvas_item_set_clip ( get_canvas_item ( ) ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// When a shaped text is invalidated by an external source, we want to reshape it.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! TS - > shaped_text_is_ready ( para . text_rid ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													para . dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( const  RID  & line_rid  :  para . lines_rid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ! TS - > shaped_text_is_ready ( line_rid ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														para . lines_dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											_ensure_shaped ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											RID  ci  =  get_canvas_item ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-17 11:05:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bool  has_settings  =  settings . is_valid ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-31 15:02:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Ref < StyleBox >  style  =  theme_cache . normal_style ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Ref < Font >  font  =  ( settings . is_valid ( )  & &  settings - > get_font ( ) . is_valid ( ) )  ?  settings - > get_font ( )  :  theme_cache . font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  font_size  =  settings . is_valid ( )  ?  settings - > get_font_size ( )  :  theme_cache . font_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  font_h  =  font - > get_height ( font_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-31 15:02:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  font_color  =  has_settings  ?  settings - > get_font_color ( )  :  theme_cache . font_color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Color  font_shadow_color  =  has_settings  ?  settings - > get_shadow_color ( )  :  theme_cache . font_shadow_color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Point2  shadow_ofs  =  has_settings  ?  settings - > get_shadow_offset ( )  :  theme_cache . font_shadow_offset ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  paragraph_spacing  =  has_settings  ?  settings - > get_paragraph_spacing ( )  :  theme_cache . paragraph_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-31 15:02:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  font_outline_color  =  has_settings  ?  settings - > get_outline_color ( )  :  theme_cache . font_outline_color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  outline_size  =  has_settings  ?  settings - > get_outline_size ( )  :  theme_cache . font_outline_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  shadow_outline_size  =  has_settings  ?  settings - > get_shadow_size ( )  :  theme_cache . font_shadow_outline_size ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-02 21:16:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Vector < LabelSettings : : StackedOutlineData >  stacked_outline_datas  =  has_settings  ?  settings - > get_stacked_outline_data ( )  :  Vector < LabelSettings : : StackedOutlineData > ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Vector < LabelSettings : : StackedShadowData >  stacked_shadow_datas  =  has_settings  ?  settings - > get_stacked_shadow_data ( )  :  Vector < LabelSettings : : StackedShadowData > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bool  rtl_layout  =  is_layout_rtl ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-09-03 20:39:18 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( has_focus ( true ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												theme_cache . focus_style - > draw ( ci ,  Rect2 ( Point2 ( 0 ,  0 ) ,  get_size ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												theme_cache . normal_style - > draw ( ci ,  Rect2 ( Point2 ( 0 ,  0 ) ,  get_size ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bool  trim_chars  =  ( visible_chars  > =  0 )  & &  ( visible_chars_behavior  = =  TextServer : : VC_CHARS_AFTER_SHAPING ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  trim_glyphs_ltr  =  ( visible_chars  > =  0 )  & &  ( ( visible_chars_behavior  = =  TextServer : : VC_GLYPHS_LTR )  | |  ( ( visible_chars_behavior  = =  TextServer : : VC_GLYPHS_AUTO )  & &  ! rtl_layout ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  trim_glyphs_rtl  =  ( visible_chars  > =  0 )  & &  ( ( visible_chars_behavior  = =  TextServer : : VC_GLYPHS_RTL )  | |  ( ( visible_chars_behavior  = =  TextServer : : VC_GLYPHS_AUTO )  & &  rtl_layout ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Vector2  ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  line_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  last_line ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  total_glyphs  =  get_layout_data ( ofs ,  last_line ,  line_spacing ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  processed_glyphs  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  visible_glyphs  =  total_glyphs  *  visible_ratio ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-07 19:56:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  line_index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  p  =  0 ;  p  <  paragraphs . size ( ) ;  p + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  Paragraph  & para  =  paragraphs [ p ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( line_index  +  para . lines_rid . size ( )  < =  lines_skipped )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  start  =  ( line_index  <  lines_skipped )  ?  lines_skipped  -  line_index  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  end  =  ( line_index  +  para . lines_rid . size ( )  <  last_line )  ?  para . lines_rid . size ( )  :  last_line  -  line_index ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( end  < =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bool  rtl  =  ( TS - > shaped_text_get_inferred_direction ( para . text_rid )  = =  TextServer : : DIRECTION_RTL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( int  i  =  start ;  i  <  end ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														RID  line_rid  =  para . lines_rid [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Vector2  line_offset  =  _get_line_rect ( p ,  i ) . position ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ofs . x  =  line_offset . x ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-22 22:49:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														double  asc  =  TS - > shaped_text_get_ascent ( line_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														double  dsc  =  TS - > shaped_text_get_descent ( line_rid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( asc  +  dsc  <  font_h )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-22 22:49:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															double  diff  =  font_h  -  ( asc  +  dsc ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-18 22:07:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															asc  + =  diff  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															dsc  + =  diff  -  ( diff  /  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														const  Glyph  * glyphs  =  TS - > shaped_text_get_glyphs ( line_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														int  gl_size  =  TS - > shaped_text_get_glyph_count ( line_rid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														int  ellipsis_pos  =  TS - > shaped_text_get_ellipsis_pos ( line_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														int  trim_pos  =  TS - > shaped_text_get_trim_pos ( line_rid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														const  Glyph  * ellipsis_glyphs  =  TS - > shaped_text_get_ellipsis_glyphs ( line_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														int  ellipsis_gl_size  =  TS - > shaped_text_get_ellipsis_glyph_count ( line_rid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ofs . y  + =  asc ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-04-02 21:16:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														// Draw text effects and main texts. Note: Do not merge this into the single loop iteration, to prevent overlaps.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														int  processed_glyphs_step  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-15 11:24:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-04-02 21:16:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														// Draw shadow outline.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( font_shadow_color . a  ! =  0  & &  shadow_outline_size  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															draw_text ( rtl ,  ellipsis_pos ,  ellipsis_gl_size ,  ellipsis_glyphs ,  trim_chars ,  para . start ,  visible_chars ,  trim_glyphs_ltr ,  processed_glyphs_step ,  processed_glyphs ,  visible_glyphs ,  trim_glyphs_rtl ,  total_glyphs ,  ci ,  ofs ,  gl_size ,  trim_pos ,  glyphs ,  font_shadow_color ,  draw_glyph_shadow_outline ,  shadow_outline_size ,  shadow_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// Draw shadow.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( font_shadow_color . a  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															draw_text ( rtl ,  ellipsis_pos ,  ellipsis_gl_size ,  ellipsis_glyphs ,  trim_chars ,  para . start ,  visible_chars ,  trim_glyphs_ltr ,  processed_glyphs_step ,  processed_glyphs ,  visible_glyphs ,  trim_glyphs_rtl ,  total_glyphs ,  ci ,  ofs ,  gl_size ,  trim_pos ,  glyphs ,  font_shadow_color ,  draw_glyph_shadow ,  shadow_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// Draw stacked shadow.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( stacked_shadow_datas . size ( )  ! =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															int  draw_iterations  =  stacked_shadow_datas . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															for  ( int  draw_iteration_index  =  draw_iterations  -  1 ;  draw_iteration_index  > =  0 ;  - - draw_iteration_index )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																LabelSettings : : StackedShadowData  stacked_shadow_data  =  stacked_shadow_datas [ draw_iteration_index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																if  ( stacked_shadow_data . outline_size  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	draw_text ( rtl ,  ellipsis_pos ,  ellipsis_gl_size ,  ellipsis_glyphs ,  trim_chars ,  para . start ,  visible_chars ,  trim_glyphs_ltr ,  processed_glyphs_step ,  processed_glyphs ,  visible_glyphs ,  trim_glyphs_rtl ,  total_glyphs ,  ci ,  ofs ,  gl_size ,  trim_pos ,  glyphs ,  stacked_shadow_data . color ,  draw_glyph_shadow_outline ,  stacked_shadow_data . outline_size ,  stacked_shadow_data . offset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																} 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-02 21:16:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																draw_text ( rtl ,  ellipsis_pos ,  ellipsis_gl_size ,  ellipsis_glyphs ,  trim_chars ,  para . start ,  visible_chars ,  trim_glyphs_ltr ,  processed_glyphs_step ,  processed_glyphs ,  visible_glyphs ,  trim_glyphs_rtl ,  total_glyphs ,  ci ,  ofs ,  gl_size ,  trim_pos ,  glyphs ,  stacked_shadow_data . color ,  draw_glyph_shadow ,  stacked_shadow_data . offset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-02 21:16:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// Draw stacked outline.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( stacked_outline_datas . size ( )  ! =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															int  stacked_outline_draw_size  =  outline_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															int  draw_iterations  =  stacked_outline_datas . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															for  ( int  j  =  0 ;  j  <  draw_iterations ;  j + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																int  stacked_outline_size  =  stacked_outline_datas [ j ] . size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																if  ( stacked_outline_size  < =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-15 11:24:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																} 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-02 21:16:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																stacked_outline_draw_size  + =  stacked_outline_size ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-02 21:16:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															for  ( int  draw_iteration_index  =  draw_iterations  -  1 ;  draw_iteration_index  > =  0 ;  - - draw_iteration_index )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																LabelSettings : : StackedOutlineData  stacked_outline_data  =  stacked_outline_datas [ draw_iteration_index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																if  ( stacked_outline_data . size  < =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																} 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-02 21:16:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																draw_text ( rtl ,  ellipsis_pos ,  ellipsis_gl_size ,  ellipsis_glyphs ,  trim_chars ,  para . start ,  visible_chars ,  trim_glyphs_ltr ,  processed_glyphs_step ,  processed_glyphs ,  visible_glyphs ,  trim_glyphs_rtl ,  total_glyphs ,  ci ,  ofs ,  gl_size ,  trim_pos ,  glyphs ,  stacked_outline_data . color ,  draw_glyph_outline ,  stacked_outline_draw_size ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																stacked_outline_draw_size  - =  stacked_outline_data . size ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-05 14:28:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-02 21:16:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// Draw outline.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( outline_size  >  0  & &  font_outline_color . a  ! =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															draw_text ( rtl ,  ellipsis_pos ,  ellipsis_gl_size ,  ellipsis_glyphs ,  trim_chars ,  para . start ,  visible_chars ,  trim_glyphs_ltr ,  processed_glyphs_step ,  processed_glyphs ,  visible_glyphs ,  trim_glyphs_rtl ,  total_glyphs ,  ci ,  ofs ,  gl_size ,  trim_pos ,  glyphs ,  font_outline_color ,  draw_glyph_outline ,  outline_size ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// Draw text.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															draw_text ( rtl ,  ellipsis_pos ,  ellipsis_gl_size ,  ellipsis_glyphs ,  trim_chars ,  para . start ,  visible_chars ,  trim_glyphs_ltr ,  processed_glyphs_step ,  processed_glyphs ,  visible_glyphs ,  trim_glyphs_rtl ,  total_glyphs ,  ci ,  ofs ,  gl_size ,  trim_pos ,  glyphs ,  font_color ,  draw_glyph ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														processed_glyphs  =  processed_glyphs_step ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ofs . y  + =  dsc  +  line_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-11 00:09:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ofs . y  + =  paragraph_spacing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-11 00:09:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											font_dirty  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-07 19:56:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_RESIZED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												para . lines_dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 14:30:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Rect2  Label : : get_character_bounds ( int  p_pos )  const  {  
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_ensure_shaped ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 14:30:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  paragraph_spacing  =  settings . is_valid ( )  ?  settings - > get_paragraph_spacing ( )  :  theme_cache . paragraph_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Font >  font  =  ( settings . is_valid ( )  & &  settings - > get_font ( ) . is_valid ( ) )  ?  settings - > get_font ( )  :  theme_cache . font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_size  =  settings . is_valid ( )  ?  settings - > get_font_size ( )  :  theme_cache . font_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_h  =  font - > get_height ( font_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 14:30:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector2  ofs ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  line_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  last_line ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									get_layout_data ( ofs ,  last_line ,  line_spacing ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  line_index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  p  =  0 ;  p  <  paragraphs . size ( ) ;  p + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  Paragraph  & para  =  paragraphs [ p ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( line_index  +  para . lines_rid . size ( )  < =  lines_skipped )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  start  =  ( line_index  <  lines_skipped )  ?  lines_skipped  -  line_index  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  end  =  ( line_index  +  para . lines_rid . size ( )  <  last_line )  ?  para . lines_rid . size ( )  :  last_line  -  line_index ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( end  < =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  start ;  i  <  end ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												RID  line_rid  =  para . lines_rid [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Rect2  line_rect  =  _get_line_rect ( p ,  i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ofs . x  =  line_rect . position . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  v_size  =  TS - > shaped_text_get_glyph_count ( line_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  Glyph  * glyphs  =  TS - > shaped_text_get_glyphs ( line_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  gl_off  =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  j  =  0 ;  j  <  v_size ;  j + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ( glyphs [ j ] . count  >  0 )  & &  ( ( glyphs [ j ] . index  ! =  0 )  | |  ( ( glyphs [ j ] . flags  &  TextServer : : GRAPHEME_IS_SPACE )  = =  TextServer : : GRAPHEME_IS_SPACE ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( p_pos  > =  glyphs [ j ] . start  +  para . start  & &  p_pos  <  glyphs [ j ] . end  +  para . start )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															float  advance  =  0.f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															for  ( int  k  =  0 ;  k  <  glyphs [ j ] . count ;  k + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																advance  + =  glyphs [ j  +  k ] . advance ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															Rect2  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															rect . position  =  ofs  +  Vector2 ( gl_off ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															rect . size  =  Vector2 ( advance ,  line_rect . size . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															return  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 14:30:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													gl_off  + =  glyphs [ j ] . advance  *  glyphs [ j ] . repeat ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 14:30:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 17:59:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												double  asc  =  TS - > shaped_text_get_ascent ( line_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												double  dsc  =  TS - > shaped_text_get_descent ( line_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( asc  +  dsc  <  font_h )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													double  diff  =  font_h  -  ( asc  +  dsc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													asc  + =  diff  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													dsc  + =  diff  -  ( diff  /  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ofs . y  + =  asc  +  dsc  +  line_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 14:30:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ofs . y  + =  paragraph_spacing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 14:30:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  Rect2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								Size2  Label : : get_minimum_size ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_ensure_shaped ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-19 14:05:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-12 21:13:49 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Size2  min_size  =  minsize ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-31 15:02:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Ref < Font >  & font  =  ( settings . is_valid ( )  & &  settings - > get_font ( ) . is_valid ( ) )  ?  settings - > get_font ( )  :  theme_cache . font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_size  =  settings . is_valid ( )  ?  settings - > get_font_size ( )  :  theme_cache . font_size ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-17 11:05:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-07 00:02:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									min_size . height  =  MAX ( min_size . height ,  font - > get_height ( font_size ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-12 21:13:49 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-31 15:02:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Size2  min_style  =  theme_cache . normal_style - > get_minimum_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( autowrap_mode  ! =  TextServer : : AUTOWRAP_OFF )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  Size2 ( 1 ,  ( clip  | |  overrun_behavior  ! =  TextServer : : OVERRUN_NO_TRIMMING )  ?  1  :  min_size . height )  +  min_style ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( clip  | |  overrun_behavior  ! =  TextServer : : OVERRUN_NO_TRIMMING )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-12 21:13:49 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											min_size . width  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-12 21:13:49 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  min_size  +  min_style ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-07 19:56:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-05 23:50:38 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# ifndef DISABLE_DEPRECATED 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  Label : : _set ( const  StringName  & p_name ,  const  Variant  & p_value )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_name  = =  SNAME ( " valign " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_vertical_alignment ( ( VerticalAlignment ) p_value . operator  int ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( p_name  = =  SNAME ( " align " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_horizontal_alignment ( ( HorizontalAlignment ) p_value . operator  int ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								int  Label : : get_line_count ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! is_inside_tree ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-10 23:50:50 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_ensure_shaped ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  total_line_count ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-18 23:31:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  Label : : get_visible_line_count ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2022-08-31 15:02:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < StyleBox >  style  =  theme_cache . normal_style ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-01 21:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Font >  font  =  ( settings . is_valid ( )  & &  settings - > get_font ( ) . is_valid ( ) )  ?  settings - > get_font ( )  :  theme_cache . font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_size  =  settings . is_valid ( )  ?  settings - > get_font_size ( )  :  theme_cache . font_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_h  =  font - > get_height ( font_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-31 15:02:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  line_spacing  =  settings . is_valid ( )  ?  settings - > get_line_spacing ( )  :  theme_cache . line_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  paragraph_spacing  =  settings . is_valid ( )  ?  settings - > get_paragraph_spacing ( )  :  theme_cache . paragraph_spacing ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 08:57:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  lines_visible  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 18:24:36 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  total_h  =  0.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-18 23:31:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  line_index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( line_index  +  para . lines_rid . size ( )  < =  lines_skipped )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  start  =  ( line_index  <  lines_skipped )  ?  lines_skipped  -  line_index  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  start ;  i  <  para . lines_rid . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 17:59:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												double  asc  =  TS - > shaped_text_get_ascent ( para . lines_rid [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												double  dsc  =  TS - > shaped_text_get_descent ( para . lines_rid [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( asc  +  dsc  <  font_h )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													double  diff  =  font_h  -  ( asc  +  dsc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													asc  + =  diff  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													dsc  + =  diff  -  ( diff  /  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												total_h  + =  asc  +  dsc  +  line_spacing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( total_h  >  Math : : ceil ( get_size ( ) . height  -  style - > get_minimum_size ( ) . height  +  line_spacing ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												lines_visible + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											total_h  + =  paragraph_spacing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											line_index  + =  para . lines_rid . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-18 23:31:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 08:57:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( max_lines_visible  > =  0  & &  lines_visible  >  max_lines_visible )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										lines_visible  =  max_lines_visible ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-18 23:31:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 08:57:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  lines_visible ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-18 23:31:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 20:58:47 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_horizontal_alignment ( HorizontalAlignment  p_alignment )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_INDEX ( ( int ) p_alignment ,  4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( horizontal_alignment  = =  p_alignment )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( horizontal_alignment  = =  HORIZONTAL_ALIGNMENT_FILL  | |  p_alignment  = =  HORIZONTAL_ALIGNMENT_FILL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											para . lines_dirty  =  true ;  // Reshape lines.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									horizontal_alignment  =  p_alignment ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_accessibility_update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 20:58:47 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HorizontalAlignment  Label : : get_horizontal_alignment ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  horizontal_alignment ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 20:58:47 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_vertical_alignment ( VerticalAlignment  p_alignment )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_INDEX ( ( int ) p_alignment ,  4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( vertical_alignment  = =  p_alignment )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 20:58:47 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									vertical_alignment  =  p_alignment ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 20:58:47 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								VerticalAlignment  Label : : get_vertical_alignment ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  vertical_alignment ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_text ( const  String  & p_string )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( text  = =  p_string )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									text  =  p_string ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-27 14:31:33 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									xl_text  =  atr ( p_string ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									text_dirty  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 20:06:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( visible_ratio  <  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										visible_chars  =  get_total_character_count ( )  *  visible_ratio ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_accessibility_update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 14:02:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_minimum_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-08 15:56:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-17 11:05:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : _invalidate ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									font_dirty  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-17 11:05:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  Label : : set_label_settings ( const  Ref < LabelSettings >  & p_settings )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( settings  ! =  p_settings )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( settings . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-03 21:29:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											settings - > disconnect_changed ( callable_mp ( this ,  & Label : : _invalidate ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-17 11:05:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										settings  =  p_settings ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( settings . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-03 21:29:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											settings - > connect_changed ( callable_mp ( this ,  & Label : : _invalidate ) ,  CONNECT_REFERENCE_COUNTED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-17 11:05:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_invalidate ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Ref < LabelSettings >  Label : : get_label_settings ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  settings ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_text_direction ( Control : : TextDirection  p_text_direction )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND ( ( int ) p_text_direction  <  - 1  | |  ( int ) p_text_direction  >  3 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( text_direction  ! =  p_text_direction )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										text_direction  =  p_text_direction ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											para . dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-19 13:27:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_structured_text_bidi_override ( TextServer : : StructuredTextParser  p_parser )  {  
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( st_parser  ! =  p_parser )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										st_parser  =  p_parser ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											para . dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-19 13:27:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TextServer : : StructuredTextParser  Label : : get_structured_text_bidi_override ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  st_parser ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  Label : : set_structured_text_bidi_override_options ( Array  p_args )  {  
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( st_args  = =  p_args )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									st_args  =  p_args ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										para . dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Array  Label : : get_structured_text_bidi_override_options ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  st_args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Control : : TextDirection  Label : : get_text_direction ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  text_direction ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  Label : : set_language ( const  String  & p_language )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( language  ! =  p_language )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										language  =  p_language ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											para . dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								String  Label : : get_language ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  language ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_paragraph_separator ( const  String  & p_paragraph_separator )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( paragraph_separator  ! =  p_paragraph_separator )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										paragraph_separator  =  p_paragraph_separator ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										text_dirty  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_accessibility_update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								String  Label : : get_paragraph_separator ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  paragraph_separator ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  Label : : set_clip_text ( bool  p_clip )  {  
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( clip  = =  p_clip )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									clip  =  p_clip ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 14:02:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_minimum_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  Label : : is_clipping_text ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  clip ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-16 14:48:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_tab_stops ( const  PackedFloat32Array  & p_tab_stops )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( tab_stops  ! =  p_tab_stops )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										tab_stops  =  p_tab_stops ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											para . dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-16 14:48:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PackedFloat32Array  Label : : get_tab_stops ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  tab_stops ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_text_overrun_behavior ( TextServer : : OverrunBehavior  p_behavior )  {  
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( overrun_behavior  = =  p_behavior )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 16:43:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									overrun_behavior  =  p_behavior ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										para . lines_dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( clip  | |  overrun_behavior  ! =  TextServer : : OVERRUN_NO_TRIMMING )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 14:02:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										update_minimum_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 16:43:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TextServer : : OverrunBehavior  Label : : get_text_overrun_behavior ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2021-07-04 16:43:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  overrun_behavior ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-01 13:39:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_ellipsis_char ( const  String  & p_char )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  c  =  p_char ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( c . length ( )  >  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										WARN_PRINT ( " Ellipsis must be exactly one character long ( "  +  itos ( c . length ( ) )  +  "  characters given). " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										c  =  c . left ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( el_char  = =  c )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									el_char  =  c ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										para . lines_dirty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-01 13:39:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( clip  | |  overrun_behavior  ! =  TextServer : : OVERRUN_NO_TRIMMING )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										update_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								String  Label : : get_ellipsis_char ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  el_char ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								String  Label : : get_text ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  text ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-05-31 23:50:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  Label : : set_visible_characters ( int  p_amount )  {  
						 
					
						
							
								
									
										
										
										
											2021-09-20 09:35:24 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( visible_chars  ! =  p_amount )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										visible_chars  =  p_amount ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-06-09 23:38:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( p_amount  = =  - 1  | |  get_total_character_count ( )  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 20:06:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											visible_ratio  =  1.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-06-09 23:38:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											visible_ratio  =  ( float ) p_amount  /  ( float ) get_total_character_count ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-20 09:35:24 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( visible_chars_behavior  = =  TextServer : : VC_CHARS_BEFORE_SHAPING )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											text_dirty  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_accessibility_update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-05 14:28:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-11 00:09:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-09-07 22:56:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  Label : : get_visible_characters ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  visible_chars ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 20:06:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_visible_ratio ( float  p_ratio )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( visible_ratio  ! =  p_ratio )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-01 19:22:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( p_ratio  > =  1.0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-20 09:35:24 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											visible_chars  =  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 20:06:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											visible_ratio  =  1.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-01 19:22:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  if  ( p_ratio  <  0.0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 23:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											visible_chars  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 20:06:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											visible_ratio  =  0.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-20 09:35:24 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 20:06:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											visible_chars  =  get_total_character_count ( )  *  p_ratio ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											visible_ratio  =  p_ratio ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-20 09:35:24 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 23:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( visible_chars_behavior  = =  TextServer : : VC_CHARS_BEFORE_SHAPING )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											text_dirty  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_accessibility_update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-05 14:28:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-07 19:56:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 20:06:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								float  Label : : get_visible_ratio ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  visible_ratio ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TextServer : : VisibleCharactersBehavior  Label : : get_visible_characters_behavior ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2021-12-05 14:28:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  visible_chars_behavior ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_visible_characters_behavior ( TextServer : : VisibleCharactersBehavior  p_behavior )  {  
						 
					
						
							
								
									
										
										
										
											2021-12-05 14:28:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( visible_chars_behavior  ! =  p_behavior )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( visible_chars_behavior  = =  TextServer : : VC_CHARS_BEFORE_SHAPING  | |  p_behavior  = =  TextServer : : VC_CHARS_BEFORE_SHAPING )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											text_dirty  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_accessibility_update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-05 14:28:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										visible_chars_behavior  =  p_behavior ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-05 14:28:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-09-07 19:56:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  Label : : set_lines_skipped ( int  p_lines )  {  
						 
					
						
							
								
									
										
										
										
											2021-02-21 14:03:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND ( p_lines  <  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( lines_skipped  = =  p_lines )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									lines_skipped  =  p_lines ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_update_visible ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-07 19:56:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  Label : : get_lines_skipped ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2015-09-07 19:56:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  lines_skipped ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  Label : : set_max_lines_visible ( int  p_lines )  {  
						 
					
						
							
								
									
										
										
										
											2022-03-16 15:50:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( max_lines_visible  = =  p_lines )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									max_lines_visible  =  p_lines ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-23 10:35:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_update_visible ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-07 19:56:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  Label : : get_max_lines_visible ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2015-09-07 19:56:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  max_lines_visible ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  Label : : get_total_character_count ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  xl_text . length ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  Label : : _bind_methods ( )  {  
						 
					
						
							
								
									
										
										
										
											2021-11-24 20:58:47 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_horizontal_alignment " ,  " alignment " ) ,  & Label : : set_horizontal_alignment ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_horizontal_alignment " ) ,  & Label : : get_horizontal_alignment ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_vertical_alignment " ,  " alignment " ) ,  & Label : : set_vertical_alignment ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_vertical_alignment " ) ,  & Label : : get_vertical_alignment ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_text " ,  " text " ) ,  & Label : : set_text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_text " ) ,  & Label : : get_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-17 11:05:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_label_settings " ,  " settings " ) ,  & Label : : set_label_settings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_label_settings " ) ,  & Label : : get_label_settings ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_text_direction " ,  " direction " ) ,  & Label : : set_text_direction ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_text_direction " ) ,  & Label : : get_text_direction ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_language " ,  " language " ) ,  & Label : : set_language ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_language " ) ,  & Label : : get_language ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_paragraph_separator " ,  " paragraph_separator " ) ,  & Label : : set_paragraph_separator ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_paragraph_separator " ) ,  & Label : : get_paragraph_separator ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 16:43:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_autowrap_mode " ,  " autowrap_mode " ) ,  & Label : : set_autowrap_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_autowrap_mode " ) ,  & Label : : get_autowrap_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:57:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_autowrap_trim_flags " ,  " autowrap_trim_flags " ) ,  & Label : : set_autowrap_trim_flags ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_autowrap_trim_flags " ) ,  & Label : : get_autowrap_trim_flags ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 11:22:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_justification_flags " ,  " justification_flags " ) ,  & Label : : set_justification_flags ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_justification_flags " ) ,  & Label : : get_justification_flags ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_clip_text " ,  " enable " ) ,  & Label : : set_clip_text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " is_clipping_text " ) ,  & Label : : is_clipping_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-16 14:48:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_tab_stops " ,  " tab_stops " ) ,  & Label : : set_tab_stops ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_tab_stops " ) ,  & Label : : get_tab_stops ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 16:43:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_text_overrun_behavior " ,  " overrun_behavior " ) ,  & Label : : set_text_overrun_behavior ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_text_overrun_behavior " ) ,  & Label : : get_text_overrun_behavior ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-01 13:39:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_ellipsis_char " ,  " char " ) ,  & Label : : set_ellipsis_char ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_ellipsis_char " ) ,  & Label : : get_ellipsis_char ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_uppercase " ,  " enable " ) ,  & Label : : set_uppercase ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " is_uppercase " ) ,  & Label : : is_uppercase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_line_height " ,  " line " ) ,  & Label : : get_line_height ,  DEFVAL ( - 1 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_line_count " ) ,  & Label : : get_line_count ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_visible_line_count " ) ,  & Label : : get_visible_line_count ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_total_character_count " ) ,  & Label : : get_total_character_count ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_visible_characters " ,  " amount " ) ,  & Label : : set_visible_characters ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_visible_characters " ) ,  & Label : : get_visible_characters ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-05 14:28:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_visible_characters_behavior " ) ,  & Label : : get_visible_characters_behavior ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_visible_characters_behavior " ,  " behavior " ) ,  & Label : : set_visible_characters_behavior ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 20:06:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_visible_ratio " ,  " ratio " ) ,  & Label : : set_visible_ratio ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_visible_ratio " ) ,  & Label : : get_visible_ratio ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_lines_skipped " ,  " lines_skipped " ) ,  & Label : : set_lines_skipped ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_lines_skipped " ) ,  & Label : : get_lines_skipped ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 08:57:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_max_lines_visible " ,  " lines_visible " ) ,  & Label : : set_max_lines_visible ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_max_lines_visible " ) ,  & Label : : get_max_lines_visible ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_structured_text_bidi_override " ,  " parser " ) ,  & Label : : set_structured_text_bidi_override ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_structured_text_bidi_override " ) ,  & Label : : get_structured_text_bidi_override ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_structured_text_bidi_override_options " ,  " args " ) ,  & Label : : set_structured_text_bidi_override_options ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_structured_text_bidi_override_options " ) ,  & Label : : get_structured_text_bidi_override_options ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 14:30:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_character_bounds " ,  " pos " ) ,  & Label : : get_character_bounds ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : STRING ,  " text " ,  PROPERTY_HINT_MULTILINE_TEXT ) ,  " set_text " ,  " get_text " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-17 11:05:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : OBJECT ,  " label_settings " ,  PROPERTY_HINT_RESOURCE_TYPE ,  " LabelSettings " ) ,  " set_label_settings " ,  " get_label_settings " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 20:58:47 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " horizontal_alignment " ,  PROPERTY_HINT_ENUM ,  " Left,Center,Right,Fill " ) ,  " set_horizontal_alignment " ,  " get_horizontal_alignment " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " vertical_alignment " ,  PROPERTY_HINT_ENUM ,  " Top,Center,Bottom,Fill " ) ,  " set_vertical_alignment " ,  " get_vertical_alignment " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 16:43:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " autowrap_mode " ,  PROPERTY_HINT_ENUM ,  " Off,Arbitrary,Word,Word (Smart) " ) ,  " set_autowrap_mode " ,  " get_autowrap_mode " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:57:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " autowrap_trim_flags " ,  PROPERTY_HINT_FLAGS ,  vformat ( " Trim Spaces After Break:%d,Trim Spaces Before Break:%d " ,  TextServer : : BREAK_TRIM_START_EDGE_SPACES ,  TextServer : : BREAK_TRIM_END_EDGE_SPACES ) ) ,  " set_autowrap_trim_flags " ,  " get_autowrap_trim_flags " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 11:22:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " justification_flags " ,  PROPERTY_HINT_FLAGS ,  " Kashida Justification:1,Word Justification:2,Justify Only After Last Tab:8,Skip Last Line:32,Skip Last Line With Visible Characters:64,Do Not Skip Single Line:128 " ) ,  " set_justification_flags " ,  " get_justification_flags " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : STRING ,  " paragraph_separator " ) ,  " set_paragraph_separator " ,  " get_paragraph_separator " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 11:22:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-08 11:30:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL ,  " clip_text " ) ,  " set_clip_text " ,  " is_clipping_text " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-10 08:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " text_overrun_behavior " ,  PROPERTY_HINT_ENUM ,  " Trim Nothing,Trim Characters,Trim Words,Ellipsis (6+ Characters),Word Ellipsis (6+ Characters),Ellipsis (Always),Word Ellipsis (Always) " ) ,  " set_text_overrun_behavior " ,  " get_text_overrun_behavior " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-01 13:39:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : STRING ,  " ellipsis_char " ) ,  " set_ellipsis_char " ,  " get_ellipsis_char " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-08 11:30:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL ,  " uppercase " ) ,  " set_uppercase " ,  " is_uppercase " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-16 14:48:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : PACKED_FLOAT32_ARRAY ,  " tab_stops " ) ,  " set_tab_stops " ,  " get_tab_stops " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-27 20:18:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_GROUP ( " Displayed Text " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-11 12:29:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " lines_skipped " ,  PROPERTY_HINT_RANGE ,  " 0,999,1 " ) ,  " set_lines_skipped " ,  " get_lines_skipped " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " max_lines_visible " ,  PROPERTY_HINT_RANGE ,  " -1,999,1 " ) ,  " set_max_lines_visible " ,  " get_max_lines_visible " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 20:06:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Note: "visible_characters" and "visible_ratio" should be set after "text" to be correctly applied.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-20 09:35:24 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " visible_characters " ,  PROPERTY_HINT_RANGE ,  " -1,128000,1 " ) ,  " set_visible_characters " ,  " get_visible_characters " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-05 14:28:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " visible_characters_behavior " ,  PROPERTY_HINT_ENUM ,  " Characters Before Shaping,Characters After Shaping,Glyphs (Layout Direction),Glyphs (Left-to-Right),Glyphs (Right-to-Left) " ) ,  " set_visible_characters_behavior " ,  " get_visible_characters_behavior " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-20 20:06:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : FLOAT ,  " visible_ratio " ,  PROPERTY_HINT_RANGE ,  " 0,1,0.001 " ) ,  " set_visible_ratio " ,  " get_visible_ratio " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-11 12:29:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-09 12:47:10 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_GROUP ( " BiDi " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-11 12:29:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " text_direction " ,  PROPERTY_HINT_ENUM ,  " Auto,Left-to-Right,Right-to-Left,Inherited " ) ,  " set_text_direction " ,  " get_text_direction " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : STRING ,  " language " ,  PROPERTY_HINT_LOCALE_ID ,  " " ) ,  " set_language " ,  " get_language " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:00:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " structured_text_bidi_override " ,  PROPERTY_HINT_ENUM ,  " Default,URI,File,Email,List,None,Custom " ) ,  " set_structured_text_bidi_override " ,  " get_structured_text_bidi_override " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : ARRAY ,  " structured_text_bidi_override_options " ) ,  " set_structured_text_bidi_override_options " ,  " get_structured_text_bidi_override_options " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-08 21:00:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_THEME_ITEM_CUSTOM ( Theme : : DATA_TYPE_STYLEBOX ,  Label ,  normal_style ,  " normal " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_THEME_ITEM_CUSTOM ( Theme : : DATA_TYPE_STYLEBOX ,  Label ,  focus_style ,  " focus " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-08 21:00:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_THEME_ITEM ( Theme : : DATA_TYPE_CONSTANT ,  Label ,  line_spacing ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_THEME_ITEM ( Theme : : DATA_TYPE_CONSTANT ,  Label ,  paragraph_spacing ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-08 21:00:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_THEME_ITEM ( Theme : : DATA_TYPE_FONT ,  Label ,  font ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_THEME_ITEM ( Theme : : DATA_TYPE_FONT_SIZE ,  Label ,  font_size ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_THEME_ITEM ( Theme : : DATA_TYPE_COLOR ,  Label ,  font_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_THEME_ITEM ( Theme : : DATA_TYPE_COLOR ,  Label ,  font_shadow_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_THEME_ITEM_CUSTOM ( Theme : : DATA_TYPE_CONSTANT ,  Label ,  font_shadow_offset . x ,  " shadow_offset_x " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_THEME_ITEM_CUSTOM ( Theme : : DATA_TYPE_CONSTANT ,  Label ,  font_shadow_offset . y ,  " shadow_offset_y " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_THEME_ITEM ( Theme : : DATA_TYPE_COLOR ,  Label ,  font_outline_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_THEME_ITEM_CUSTOM ( Theme : : DATA_TYPE_CONSTANT ,  Label ,  font_outline_size ,  " outline_size " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_THEME_ITEM_CUSTOM ( Theme : : DATA_TYPE_CONSTANT ,  Label ,  font_shadow_outline_size ,  " shadow_outline_size " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Label : : Label ( const  String  & p_text )  {  
						 
					
						
							
								
									
										
										
										
											2017-01-08 19:54:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_mouse_filter ( MOUSE_FILTER_IGNORE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									set_text ( p_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-17 22:47:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_v_size_flags ( SIZE_SHRINK_CENTER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Label : : ~ Label ( )  {  
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( Paragraph  & para  :  paragraphs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( const  RID  & line_rid  :  para . lines_rid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											TS - > free_rid ( line_rid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										para . lines_rid . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										TS - > free_rid ( para . text_rid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-07 19:56:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-28 10:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									paragraphs . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}