Example #1
0
            // --- functions ---
            /// <summary>Gets data associated with the specified codepoint.</summary>
            /// <param name="text">The string containing the codepoint.</param>
            /// <param name="offset">The offset at which to read the codepoint. For surrogate pairs, two characters are read, and one otherwise.</param>
            /// <param name="texture">Receives the texture that contains the codepoint.</param>
            /// <param name="data">Receives the data that describes the codepoint.</param>
            /// <returns>The number of characters read.</returns>
            internal int GetCharacterData(string text, int offset, out int texture, out OpenGlFontChar data)
            {
                int value = char.ConvertToUtf32(text, offset);
                int hi    = value >> 8;
                int lo    = value & 0xFF;

                if (this.Tables[hi] == null || this.Tables[hi].Texture <= 0)
                {
                    this.Tables[hi] = new OpenGlFontTable(this.Font, hi << 8);
                }
                texture = this.Tables[hi].Texture;
                data    = this.Tables[hi].Characters[lo];
                return(value >= 0x10000 ? 2 : 1);
            }
Example #2
0
			// --- functions ---
			/// <summary>Gets data associated with the specified codepoint.</summary>
			/// <param name="text">The string containing the codepoint.</param>
			/// <param name="offset">The offset at which to read the codepoint. For surrogate pairs, two characters are read, and one otherwise.</param>
			/// <param name="texture">Receives the texture that contains the codepoint.</param>
			/// <param name="data">Receives the data that describes the codepoint.</param>
			/// <returns>The number of characters read.</returns>
			internal int GetCharacterData(string text, int offset, out Textures.Texture texture, out OpenGlFontChar data) {
				int value = char.ConvertToUtf32(text, offset);
				int hi = value >> 8;
				int lo = value & 0xFF;
				this.Tables[hi] = this.Tables[hi] ?? new OpenGlFontTable(this.Font, hi << 8);
				texture = this.Tables[hi].Texture;
				data = this.Tables[hi].Characters[lo];
				return value >= 0x10000 ? 2 : 1;
			}