<commit_before>Ui.Element.extend('Ui.Text', 
/**@lends Ui.Text#*/
{
	text: '',
	fontSize: undefined,
	fontFamily: undefined,
	fontWeight: undefined,
	color: undefined,
	textAlign: undefined,

	measureDrawing: undefined,
	textDrawing: undefined,
	// var needed to update the layout
	line: undefined,
	word: undefined,
	words: undefined,
	flowRender: false,
	offsetX: 0,
	offsetY: 0,
	spaceWidth: undefined,
	maxWidth: undefined,
	lineHeight: undefined,
	selectable: false,
	textMeasureValid: false,

    /**
     * @constructs
	 * @class      
     * @extends Ui.Element
     * @param {String} [config.text]
     * @param {Number} [config.fontSize]
     * @param {String} [config.fontFamily]
     * @param {String} [config.fontWeight]
     * @param {String} [config.color]
     * @param {Boolean} [config.selectable] Whether or not the text can be selected
	 * @param {mixed} [config] see {@link Ui.Element} constructor for more options.  
     */ 
	constructor: function(config) {
		this.autoConfig(config, 'text', 'fontSize', 'fontFamily', 'fontWeight',
			'color', 'selectable', 'textAlign');
	},

	getText: function() {
		return this.text;
	},

	setText: function(text) {
		if(this.text != text) {
			this.text = text;
			this.splitText();
			this.invalidateMeasure();
		}
	},

	getTextAlign: function() {
		if(this.textAlign !== undefined)
			return this.textAlign;
		else
			return this.getStyleProperty('textAlign');
	},

	setTextAlign: function(textAlign) {
		if(this.textAlign != textAlign) {
			this.textAlign = textAlign;
			this.invalidateMeasure();
		}
	},

	setFontSize: function(fontSize) {
		if(this.fontSize != fontSize) {
			this.fontSize = fontSize;
			this.textDrawing.style.fontSize = this.getFontSize()+'px';
			this.textMeasureValid = false;
			this.invalidateMeasure();
		}
	},

	getFontSize: function() {
		if(this.fontSize !== undefined)
			return this.fontSize;
		else<commit_msg>correct initial measure bug in Ui.Text<commit_after>Ui.Element.extend('Ui.Text', 
/**@lends Ui.Text#*/
{
	text: '',
	fontSize: undefined,
	fontFamily: undefined,
	fontWeight: undefined,
	color: undefined,
	textAlign: undefined,

	measureDrawing: undefined,
	textDrawing: undefined,
	// var needed to update the layout
	line: undefined,
	word: undefined,
	words: undefined,
	flowRender: false,
	offsetX: 0,
	offsetY: 0,
	spaceWidth: undefined,
	maxWidth: undefined,
	lineHeight: undefined,
	selectable: false,
	textMeasureValid: false,

    /**
     * @constructs
	 * @class      
     * @extends Ui.Element
     * @param {String} [config.text]
     * @param {Number} [config.fontSize]
     * @param {String} [config.fontFamily]
     * @param {String} [config.fontWeight]
     * @param {String} [config.color]
     * @param {Boolean} [config.selectable] Whether or not the text can be selected
	 * @param {mixed} [config] see {@link Ui.Element} constructor for more options.  
     */ 
	constructor: function(config) {
		this.words = [];
		this.autoConfig(config, 'text', 'fontSize', 'fontFamily', 'fontWeight',
			'color', 'selectable', 'textAlign');
	},

	getText: function() {
		return this.text;
	},

	setText: function(text) {
		if(this.text != text) {
			this.text = text;
			this.splitText();
			this.textMeasureValid = false;
			this.invalidateMeasure();
		}
	},

	getTextAlign: function() {
		if(this.textAlign !== undefined)
			return this.textAlign;
		else
			return this.getStyleProperty('textAlign');
	},

	setTextAlign: function(textAlign) {
		if(this.textAlign != textAlign) {
			this.textAlign = textAlign;
			this.invalidateMeasure();
		}
	},

	setFontSize: function(fontSize) {
		if(this.fontSize != fontSize) {
			this.fontSize = fontSize;
			this.textDrawing.style.fontSize = this.getFontSize()+'px';
			this.textMeasureValid = false;
			this.invalidateMeasure();
		}
	},

	getFontSize: function() {
		if(this.fontSize !== undefined)
			return this.fontSize;
		else
{'fraction_non_alphanumeric': 0.14370179948586118, 'fraction_numerical': 0.0010282776349614395, 'mean_word_length': 3.827543424317618, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6222809', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1285, 'n_words': 291}