Esempio n. 1
0
        /// <summary>
        /// Adds the characters of the specified string to the hashtable.
        /// </summary>
        public void AddChars(string text)
        {
            if (text != null)
            {
                bool symbol = this.descriptor.fontData.cmap.symbol;
                int  length = text.Length;
                for (int idx = 0; idx < length; idx++)
                {
                    char ch = text[idx];
                    if (!CharacterToGlyphIndex.ContainsKey(ch))
                    {
                        int glyphIndex = 0;
                        if (this.descriptor != null)
                        {
                            if (symbol)
                            {
                                glyphIndex = ch + (descriptor.fontData.os2.usFirstCharIndex & 0xFF00); // @@@
                                glyphIndex = descriptor.CharCodeToGlyphIndex((char)glyphIndex);
                            }
                            else
                            {
                                glyphIndex = descriptor.CharCodeToGlyphIndex(ch);
                            }
                        }

                        CharacterToGlyphIndex.Add(ch, glyphIndex);
                        //GlyphIndices.Add(glyphIndex, null);
                        GlyphIndices[glyphIndex] = null;
                        this.MinChar             = (char)Math.Min(this.MinChar, ch);
                        this.MaxChar             = (char)Math.Max(this.MaxChar, ch);
                    }
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Adds the characters of the specified string to the hashtable.
 /// </summary>
 public void AddChars(string text)
 {
     if (text != null)
     {
         bool symbol = _descriptor.FontFace.cmap.symbol;
         int  length = text.Length;
         for (int idx = 0; idx < length; idx++)
         {
             char ch = text[idx];
             if (!CharacterToGlyphIndex.ContainsKey(ch))
             {
                 char ch2 = ch;
                 if (symbol)
                 {
                     // Remap ch for symbol fonts.
                     ch2 = (char)(ch | (_descriptor.FontFace.os2.usFirstCharIndex & 0xFF00));  // @@@ refactor
                 }
                 int glyphIndex = _descriptor.CharCodeToGlyphIndex(ch2);
                 CharacterToGlyphIndex.Add(ch, glyphIndex);
                 GlyphIndices[glyphIndex] = null;
                 MinChar = (char)Math.Min(MinChar, ch);
                 MaxChar = (char)Math.Max(MaxChar, ch);
             }
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Adds the characters of the specified string to the hashtable.
        /// </summary>
        public void AddChars(string text)
        {
            if (text != null)
            {
                bool symbol = _descriptor.FontFace.cmap.symbol;
                int  length = text.Length;
                for (int idx = 0; idx < length; idx++)
                {
                    if (char.IsLowSurrogate(text, idx))
                    {
                        continue; // Ignore the second char of a surrogate pair
                    }
                    char ch = text[idx];
                    if (!CharacterToGlyphIndex.ContainsKey(ch))
                    {
                        char ch2 = ch;
                        if (symbol)
                        {
                            // Remap ch for symbol fonts.
                            ch2 = (char)(ch | (_descriptor.FontFace.os2.usFirstCharIndex & 0xFF00));  // @@@ refactor
                        }
                        uint glyphIndex;

                        if (char.IsHighSurrogate(ch))
                        {
                            glyphIndex = _descriptor.CharCodeToGlyphIndex(ch, text[idx + 1]);
                        }
                        else
                        {
                            glyphIndex = _descriptor.CharCodeToGlyphIndex(ch2);
                        }

                        CharacterToGlyphIndex.Add(ch, glyphIndex);
                        GlyphIndices[glyphIndex] = null;
                        MinChar = (char)Math.Min(MinChar, ch);
                        MaxChar = (char)Math.Max(MaxChar, ch);
                    }
                }
            }
        }
Esempio n. 4
0
 internal bool Contains(char ch)
 {
     return(CharacterToGlyphIndex.ContainsKey(ch));
 }
Esempio n. 5
0
 internal bool Contains(char ch) => CharacterToGlyphIndex.ContainsKey(ch);