Exemplo n.º 1
0
        /// <summary> Load a font from a URL
        ///
        /// </summary>
        /// <param name="code">
        /// </param>
        /// <param name="alias">The name used to bind a DefineFont tag to a DefineEditText tag.
        /// </param>
        /// <param name="location">remote url or a relative, local file path
        /// </param>
        /// <param name="style">
        /// </param>
        /// <param name="hasLayout">
        /// </param>
        public FontBuilder(int code, FontManager manager, System.String alias, System.Uri location, int style, bool hasLayout, bool flashType) : this(code, hasLayout, flashType)
        {
            if (manager == null)
            {
                throw new NoFontManagerException();
            }

            if (Trace.font)
            {
                Trace.trace("Locating font using FontManager '" + manager.GetType().FullName + "'");
            }

            bool     useTwips = code != flash.swf.TagValues_Fields.stagDefineFont && code != flash.swf.TagValues_Fields.stagDefineFont2;
            FontFace fontFace = manager.getEntryFromLocation(location, style, useTwips);

            if (fontFace == null)
            {
                throwFontNotFound(alias, null, style, location.ToString());
            }

            if (Trace.font)
            {
                Trace.trace("Initializing font at '" + location.ToString() + "' as '" + alias + "'");
            }

            this.defaultFace = fontFace;

            init(alias);
        }
Exemplo n.º 2
0
 /// <summary> Adds all supported characters in array from the given font face.
 ///
 /// </summary>
 /// <param name="face">
 /// </param>
 /// <param name="chars">
 /// </param>
 public void  addCharset(FontFace face, char[] chars)
 {
     //TODO: Sort before adding to optimize IntMap addition
     for (int i = 0; i < chars.Length; i++)
     {
         char c = chars[i];
         addChar(face, c);
     }
 }
Exemplo n.º 3
0
		/// <summary> Adds all supported characters from 0 to the highest glyph
		/// contained in the given font face.
		/// 
		/// </summary>
		/// <param name="face">
		/// </param>
		public void  addAllChars(FontFace face)
		{
			int min = face.FirstChar;
			int count = face.NumGlyphs;
			
			if (Trace.font)
				Trace.trace("\tAdding " + count + " chars, starting from " + min);
			
			addCharset(min, count);
		}
Exemplo n.º 4
0
        /// <summary> Adds supported characters in the specified range from the given
        /// font face.
        ///
        /// </summary>
        /// <param name="face">
        /// </param>
        /// <param name="fromChar">
        /// </param>
        /// <param name="count">
        /// </param>
        public void  addCharset(FontFace face, int fromChar, int count)
        {
            int remaining = count;

            for (int i = fromChar; remaining > 0 && i < System.Char.MaxValue; i++)
            {
                char       c  = (char)i;
                GlyphEntry ge = addChar(face, c);
                if (ge != null)
                {
                    remaining--;
                }
            }
        }
Exemplo n.º 5
0
        /// <summary> If supported, includes a character from the given font face.
        ///
        /// </summary>
        /// <param name="c">
        /// </param>
        public GlyphEntry addChar(FontFace face, char c)
        {
            GlyphEntry ge = (GlyphEntry)glyphEntryMap.get_Renamed(c);

            if (ge == null)
            {
                ge = face.getGlyphEntry(c);

                if (ge != null)
                {
                    //Add to this tag's collection
                    glyphEntryMap.put(c, ge);
                }
            }

            if (flashType && ge != null && ge.zoneRecord == null && zoneRecordBuilder != null)
            {
                ge.zoneRecord = zoneRecordBuilder.build(c);
            }

            return(ge);
        }
Exemplo n.º 6
0
 /// <summary> Build a DefineFont2 or DefineFont3 tag for a given FontFace.
 ///
 /// Note that with this constructor, flashType is assumed to be false.
 ///
 /// </summary>
 /// <param name="code">Determines the version of DefineFont SWF tag to use.
 /// </param>
 /// <param name="fontFace">The FontFace to build into a DefineFont tag.
 /// </param>
 /// <param name="alias">The name used to bind a DefineFont tag to other SWF tags
 /// (such as DefineEditText).
 /// </param>
 public FontBuilder(int code, FontFace fontFace, System.String alias) : this(code, true, false)
 {
     defaultFace = fontFace;
     init(alias);
 }
Exemplo n.º 7
0
		/// <summary> If supported, includes a character from the given font face.
		/// 
		/// </summary>
		/// <param name="c">
		/// </param>
		public GlyphEntry addChar(FontFace face, char c)
		{
			GlyphEntry ge = (GlyphEntry) glyphEntryMap.get_Renamed(c);
			
			if (ge == null)
			{
				ge = face.getGlyphEntry(c);
				
				if (ge != null)
				{
					//Add to this tag's collection
					glyphEntryMap.put(c, ge);
				}
			}
			
			if (flashType && ge != null && ge.zoneRecord == null && zoneRecordBuilder != null)
			{
				ge.zoneRecord = zoneRecordBuilder.build(c);
			}
			
			return ge;
		}
Exemplo n.º 8
0
		/// <summary> Adds all supported characters in array from the given font face.
		/// 
		/// </summary>
		/// <param name="face">
		/// </param>
		/// <param name="chars">
		/// </param>
		public void  addCharset(FontFace face, char[] chars)
		{
			//TODO: Sort before adding to optimize IntMap addition
			for (int i = 0; i < chars.Length; i++)
			{
				char c = chars[i];
				addChar(face, c);
			}
		}
Exemplo n.º 9
0
		/// <summary> Adds supported characters in the specified range from the given
		/// font face.
		/// 
		/// </summary>
		/// <param name="face">
		/// </param>
		/// <param name="fromChar">
		/// </param>
		/// <param name="count">
		/// </param>
		public void  addCharset(FontFace face, int fromChar, int count)
		{
			int remaining = count;
			
			for (int i = fromChar; remaining > 0 && i < System.Char.MaxValue; i++)
			{
				char c = (char) i;
				GlyphEntry ge = addChar(face, c);
				if (ge != null)
				{
					remaining--;
				}
			}
		}
Exemplo n.º 10
0
		/// <summary> Adds all supported characters from 0 to the highest glyph
		/// contained in the given font face.
		/// 
		/// </summary>
		/// <param name="face">
		/// </param>
		public void  addAllChars(FontFace face)
		{
			int min = face.FirstChar;
			int count = face.NumGlyphs;
			
			if (Trace.font)
				Trace.trace("\tAdding " + count + " chars, starting from " + min);
			
			addCharset(min, count);
		}
Exemplo n.º 11
0
		/// <summary> Load a font from a URL
		/// 
		/// </summary>
		/// <param name="code">
		/// </param>
		/// <param name="alias">The name used to bind a DefineFont tag to a DefineEditText tag.
		/// </param>
		/// <param name="location">remote url or a relative, local file path
		/// </param>
		/// <param name="style">
		/// </param>
		/// <param name="hasLayout">
		/// </param>
		public FontBuilder(int code, FontManager manager, System.String alias, System.Uri location, int style, bool hasLayout, bool flashType):this(code, hasLayout, flashType)
		{
			
			if (manager == null)
				throw new NoFontManagerException();
			
			if (Trace.font)
				Trace.trace("Locating font using FontManager '" + manager.GetType().FullName + "'");
			
			bool useTwips = code != flash.swf.TagValues_Fields.stagDefineFont && code != flash.swf.TagValues_Fields.stagDefineFont2;
			FontFace fontFace = manager.getEntryFromLocation(location, style, useTwips);
			
			if (fontFace == null)
				throwFontNotFound(alias, null, style, location.ToString());
			
			if (Trace.font)
				Trace.trace("Initializing font at '" + location.ToString() + "' as '" + alias + "'");
			
			this.defaultFace = fontFace;
			
			init(alias);
		}
Exemplo n.º 12
0
		/// <summary> Build a DefineFont2 or DefineFont3 tag for a given FontFace.
		/// 
		/// Note that with this constructor, flashType is assumed to be false.
		/// 
		/// </summary>
		/// <param name="code">Determines the version of DefineFont SWF tag to use.
		/// </param>
		/// <param name="fontFace">The FontFace to build into a DefineFont tag.
		/// </param>
		/// <param name="alias">The name used to bind a DefineFont tag to other SWF tags
		/// (such as DefineEditText).
		/// </param>
		public FontBuilder(int code, FontFace fontFace, System.String alias):this(code, true, false)
		{
			defaultFace = fontFace;
			init(alias);
		}