コード例 #1
0
		public override void  defineFont2(DefineFont2 tag)
		{
			open(tag);
			out_Renamed.Write(" id='" + id(tag) + "'");
			out_Renamed.Write(" font='" + tag.fontName + "'");
			out_Renamed.Write(" numGlyphs='" + tag.glyphShapeTable.Length + "'");
			out_Renamed.Write(" italic='" + tag.italic + "'");
			out_Renamed.Write(" bold='" + tag.bold + "'");
			out_Renamed.Write(" ansi='" + tag.ansi + "'");
			out_Renamed.Write(" wideOffsets='" + tag.wideOffsets + "'");
			out_Renamed.Write(" wideCodes='" + tag.wideCodes + "'");
			out_Renamed.Write(" shiftJIS='" + tag.shiftJIS + "'");
			out_Renamed.Write(" langCode='" + tag.langCode + "'");
			out_Renamed.Write(" hasLayout='" + tag.hasLayout + "'");
			out_Renamed.Write(" ascent='" + tag.ascent + "'");
			out_Renamed.Write(" descent='" + tag.descent + "'");
			out_Renamed.Write(" leading='" + tag.leading + "'");
			out_Renamed.Write(" kerningCount='" + tag.kerningCount + "'");
			
			out_Renamed.Write(" codepointCount='" + tag.codeTable.Length + "'");
			
			if (tag.hasLayout)
			{
				out_Renamed.Write(" advanceCount='" + tag.advanceTable.Length + "'");
				out_Renamed.Write(" boundsCount='" + tag.boundsTable.Length + "'");
			}
			end();
			
			if (glyphs)
			{
				for (int i = 0; i < tag.kerningCount; i++)
				{
					KerningRecord rec = tag.kerningTable[i];
					indent();
					//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
					out_Renamed.WriteLine("<kerningRecord adjustment='" + rec.adjustment + "' code1='" + rec.code1 + "' code2='" + rec.code2 + "' />");
				}
				
				for (int i = 0; i < tag.glyphShapeTable.Length; i++)
				{
					indent();
					out_Renamed.Write("<glyph");
					out_Renamed.Write(" codepoint='" + ((int) tag.codeTable[i]) + (isPrintable(tag.codeTable[i])?("(" + tag.codeTable[i] + ")"):"(?)") + "'");
					if (tag.hasLayout)
					{
						out_Renamed.Write(" advance='" + tag.advanceTable[i] + "'");
						out_Renamed.Write(" bounds='" + tag.boundsTable[i] + "'");
					}
					//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
					out_Renamed.WriteLine(">");
					
					Shape shape = tag.glyphShapeTable[i];
					indent_Renamed_Field++;
					if (tabbedGlyphs)
						printShapeWithTabs(shape);
					else
						printShape(shape, true);
					indent_Renamed_Field--;
					indent();
					//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
					out_Renamed.WriteLine("</glyph>");
				}
			}
			
			close(tag);
		}
コード例 #2
0
		public override void  defineFont2(DefineFont2 tag)
		{
			int id = dict.add(tag);
			tagw.writeUI16(id);
			int startPos = tagw.Pos;
			bool again;
			
			if (tag.code == flash.swf.TagValues_Fields.stagDefineFont3)
			{
				tag.wideCodes = true;
			}
			
			if (!tag.wideCodes)
			{
				for (int i = 0; i < tag.codeTable.Length; i++)
				{
					if (tag.codeTable[i] > 255)
					{
						tag.wideCodes = true;
						break;
					}
				}
			}
			
			//UPGRADE_NOTE: Label 'loop' was moved. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1014'"
			do 
			{
				again = false;
				tagw.writeBit(tag.hasLayout);
				tagw.writeBit(tag.shiftJIS);
				tagw.writeBit(tag.smallText);
				tagw.writeBit(tag.ansi);
				tagw.writeBit(tag.wideOffsets);
				tagw.writeBit(tag.wideCodes);
				tagw.writeBit(tag.italic);
				tagw.writeBit(tag.bold);
				tagw.flushBits();
				
				tagw.writeUI8(tag.langCode);
				
				tagw.writeLengthString(tag.fontName);
				int count = tag.glyphShapeTable.Length;
				
				tagw.writeUI16(count);
				int offsetPos = tagw.Pos;
				
				// save space for the offset table
				if (tag.wideOffsets)
				{
					for (int i = 0; i < count; i++)
					{
						tagw.write32(0);
					}
				}
				else
				{
					for (int i = 0; i < count; i++)
					{
						tagw.writeUI16(0);
					}
				}
				
				//PJF: write placeholder for codeTableOffset, this will be changed after shapes encoded
				if (count > 0)
				{
					if (tag.wideOffsets)
					{
						tagw.write32(0);
					}
					else
					{
						tagw.writeUI16(0);
					}
				}
				
				for (int i = 0; i < count; i++)
				{
					// save offset to this glyph
					int offset = tagw.Pos - offsetPos;
					if (!tag.wideOffsets && offset > 65535)
					{
						again = true;
						tag.wideOffsets = true;
						tagw.Pos = startPos;
						//UPGRADE_NOTE: Labeled continue statement was changed to a goto statement. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1015'"
						goto loop;
					}
					if (tag.wideOffsets)
						tagw.write32at(offsetPos + 4 * i, offset);
					else
						tagw.writeUI16at(offsetPos + 2 * i, offset);
					
					encodeShape(tag.glyphShapeTable[i], tagw, flash.swf.TagValues_Fields.stagDefineShape3, 1, 0);
				}
				
				// update codeTableOffset
				int offset2 = tagw.Pos - offsetPos;
				if (!tag.wideOffsets && offset2 > 65535)
				{
					again = true;
					tag.wideOffsets = true;
					tagw.Pos = startPos;
					//UPGRADE_NOTE: Labeled continue statement was changed to a goto statement. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1015'"
					goto loop;
				}
				if (tag.wideOffsets)
				{
					tagw.write32at(offsetPos + 4 * count, offset2);
				}
				else
				{
					tagw.writeUI16at(offsetPos + 2 * count, offset2);
				}
				
				// now write the codetable
				
				if (tag.wideCodes)
				{
					for (int i = 0; i < tag.codeTable.Length; i++)
					{
						tagw.writeUI16(tag.codeTable[i]);
					}
				}
				else
				{
					for (int i = 0; i < tag.codeTable.Length; i++)
					{
						tagw.writeUI8(tag.codeTable[i]);
					}
				}
				
				if (tag.hasLayout)
				{
					tagw.writeSI16(tag.ascent);
					tagw.writeSI16(tag.descent);
					tagw.writeSI16(tag.leading);
					
					for (int i = 0; i < tag.advanceTable.Length; i++)
					{
						tagw.writeSI16(tag.advanceTable[i]);
					}
					
					for (int i = 0; i < tag.boundsTable.Length; i++)
					{
						encodeRect(tag.boundsTable[i], tagw);
					}
					
					tagw.writeUI16(tag.kerningTable.Length);
					
					for (int i = 0; i < tag.kerningTable.Length; i++)
					{
						if (!tag.wideCodes && ((tag.kerningTable[i].code1 > 255) || (tag.kerningTable[i].code2 > 255)))
						{
							again = true;
							tag.wideCodes = true;
							tagw.Pos = startPos;
							//UPGRADE_NOTE: Labeled continue statement was changed to a goto statement. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1015'"
							goto loop;
						}
						
						encodeKerningRecord(tag.kerningTable[i], tagw, tag.wideCodes);
					}
				}
				//UPGRADE_NOTE: Label 'loop' was moved. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1014'"
loop: ;
			}
			while (again);
			
			encodeTag(tag);
		}
コード例 #3
0
 public virtual void  defineFont2(DefineFont2 tag)
 {
 }