public static void UsingTextBuilderAndParagraph() { // ExStart:UsingTextBuilderAndParagraph // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Text(); // Create Document instance Document pdfDocument = new Document(); // Add page to pages collection of Document Page page = pdfDocument.Pages.Add(); // Create TextBuilder instance TextBuilder builder = new TextBuilder(pdfDocument.Pages[1]); // Instantiate TextParagraph instance TextParagraph paragraph = new TextParagraph(); // Create TextState instance to specify font name and size TextState state = new TextState("Arial", 12); // Specify the character spacing state.CharacterSpacing = 1.5f; // Append text to TextParagraph object paragraph.AppendLine("This is paragraph with character spacing", state); // Specify the position for TextParagraph paragraph.Position = new Position(100, 550); // Append TextParagraph to TextBuilder instance builder.AppendParagraph(paragraph); dataDir = dataDir + "CharacterSpacingUsingTextBuilderAndParagraph_out.pdf"; // Save resulting PDF document. pdfDocument.Save(dataDir); // ExEnd:UsingTextBuilderAndParagraph Console.WriteLine("\nCharacter spacing specified successfully using Text builder and paragraph.\nFile saved at " + dataDir); }
public void SaveStateText(TextWriter writer) { var s = new TextState<TextStateData>(); s.Prepare(); var ff = s.GetFunctionPointersSave(); BizSwan.bizswan_txtstatesave(Core, ref ff); SaveTextStateData(s.ExtraData); ser.Serialize(writer, s); }
public void SaveStateText(TextWriter writer) { var s = new TextState<TextStateData>(); s.Prepare(); var ff = s.GetFunctionPointersSave(); LibLynx.TxtStateSave(Core, ref ff); s.ExtraData.IsLagFrame = IsLagFrame; s.ExtraData.LagCount = LagCount; s.ExtraData.Frame = Frame; ser.Serialize(writer, s); // write extra copy of stuff we don't use writer.WriteLine(); writer.WriteLine("Frame {0}", Frame); //Console.WriteLine(BizHawk.Common.BufferExtensions.BufferExtensions.HashSHA1(SaveStateBinary())); }
protected bool visible; // property Visible #endregion Fields #region Constructors public GameText(IServiceProvider services, string spriteFontString) { this.services = services; this.spriteFontString = spriteFontString; content = new ContentManager(services, "Content"); initialized = false; textState = TextState.Inactive; drawAtCenter = false; textProperties = new List<TextProperty>(); text = "Default Text"; position = new Vector2(0, 0); color = Color.White; rotation = 0f; origin = new Vector2(0, 0); scale = new Vector2(1, 1); effects = SpriteEffects.None; layerDepth = 0f; enabled = false; visible = false; }
public void WrongPosition() { savedState = state; state = TextState.WRONG_POS; }
/// <summary> /// When started, gradually fades in text. /// </summary> /// <returns></returns> public IEnumerator StartTextFadeIn() { textState = TextState.fadingIn; TMP_TextInfo textInfo = m_TextComponent.textInfo; Color32[] newVertexColors; Color32 c0 = m_TextComponent.color; lastCharacterDone = false; if (fadeInRandom) { charOrder = handlerScript.randomOrder; } else { charOrder = handlerScript.leftRightOrder; } // Fade the text in from the middle of the text (will probably not work if the text is spread on 2+ lines). // If the text has an odd number of characters it will start from the middle character if it has an even number // it will start with both middle characters. if (fadeInFromMid) { int currentCharacter = 0; int currentCharacterLeft = 0; int currentCharacterRight = 0; //Debug.Log("Even if 0: " + textInfo.characterCount%2); // Check if even with modulo. // Even. if (textInfo.characterCount % 2 == 0) { currentCharacterLeft = textInfo.characterCount / 2 - 1; currentCharacterRight = currentCharacterLeft + 1; //Debug.Log("Cur char left: " + currentCharacterLeft + " Cur char right: " + currentCharacterRight); //Debug.Log("Tots num of char: " + textInfo.characterCount); } // Odds. else { currentCharacter = Mathf.CeilToInt(textInfo.characterCount / 2); int characterCount = textInfo.characterCount; // Get the index of the material used by the current character. int materialIndex = textInfo.characterInfo[currentCharacter].materialReferenceIndex; // Get the vertex colors of the mesh used by this text element (character or sprite). newVertexColors = textInfo.meshInfo[materialIndex].colors32; // Get the index of the first vertex used by this text element. int vertexIndex = textInfo.characterInfo[currentCharacter].vertexIndex; StartCoroutine(FadeInCharacter(materialIndex, vertexIndex, currentCharacter)); currentCharacterLeft = currentCharacter - 1; currentCharacterRight = currentCharacter + 1; } // Fade in the rest of the characters. To the Left and to the Right at the same time. while (currentCharacterRight < textInfo.characterCount) { int characterCount = textInfo.characterCount; // For the character to the left. // Get the index of the material used by the current character. int materialIndexLeft = textInfo.characterInfo[currentCharacterLeft].materialReferenceIndex; // Get the vertex colors of the mesh used by this text element (character or sprite). newVertexColors = textInfo.meshInfo[materialIndexLeft].colors32; // Get the index of the first vertex used by this text element. int vertexIndexLeft = textInfo.characterInfo[currentCharacterLeft].vertexIndex; if (textInfo.characterInfo[currentCharacterLeft].character.ToString() != " ") { StartCoroutine(FadeInCharacter(materialIndexLeft, vertexIndexLeft, currentCharacterLeft)); } //Debug.Log(currentCharacterLeft); currentCharacterLeft--; // For the character to the right. // Get the index of the material used by the current character. int materialIndexRight = textInfo.characterInfo[currentCharacterRight].materialReferenceIndex; // Get the vertex colors of the mesh used by this text element (character or sprite). newVertexColors = textInfo.meshInfo[materialIndexRight].colors32; // Get the index of the first vertex used by this text element. int vertexIndexRight = textInfo.characterInfo[currentCharacterRight].vertexIndex; if (textInfo.characterInfo[currentCharacterRight].character.ToString() != " ") { StartCoroutine(FadeInCharacter(materialIndexRight, vertexIndexRight, currentCharacterRight)); } //Debug.Log(currentCharacterRight); currentCharacterRight++; yield return(new WaitForSeconds(timeBetweenCharsIn)); } } // Fade in with the same random order as the fallScript order. else { int curChar = 0; while (curChar < textInfo.characterCount) { // Get the index of the mesh used by this character. int matIndex = textInfo.characterInfo[charOrder[curChar]].materialReferenceIndex; // Get the index of the first vertex used by this text element. int vertIndex = textInfo.characterInfo[charOrder[curChar]].vertexIndex; // Get the vertex colors of the mesh used by this text element (character or sprite). newVertexColors = textInfo.meshInfo[matIndex].colors32; if (textInfo.characterInfo[charOrder[curChar]].character.ToString() != " ") { StartCoroutine(FadeInCharacter(matIndex, vertIndex, charOrder[curChar])); } curChar++; // Delay between every text character. yield return(new WaitForSeconds(timeBetweenCharsIn)); } } // // From left to right. // else { // int currentCharacter = 0; // while (currentCharacter < textInfo.characterCount) // { // int characterCount = textInfo.characterCount; // // Get the index of the material used by the current character. // int materialIndex = textInfo.characterInfo[currentCharacter].materialReferenceIndex; // // Get the vertex colors of the mesh used by this text element (character or sprite). // newVertexColors = textInfo.meshInfo[materialIndex].colors32; // // Get the index of the first vertex used by this text element. // int vertexIndex = textInfo.characterInfo[currentCharacter].vertexIndex; // StartCoroutine(FadeInCharacter(materialIndex, vertexIndex, currentCharacter)); // currentCharacter++; // yield return new WaitForSeconds(timeBetweenCharsIn); // } // } }
IEnumerator FadeOutCharacter(int materialIndex, int vertexIndex, int currentCharacter) { TMP_TextInfo textInfo = m_TextComponent.textInfo; Color32[] newVertexColors; Color32 c0 = m_TextComponent.color; // Get the vertex colors of the mesh used by this text element (character or sprite). newVertexColors = textInfo.meshInfo[materialIndex].colors32; float alpha = 255f; float fadeToOne = 1f; while (alpha > 0) { fadeToOne -= Time.deltaTime / fadeOutDur; alpha = fadeToOne * 255; if (alpha <= 0) { alpha = 0; } if (textInfo.characterInfo[currentCharacter].isVisible) { c0 = new Color32(255, 255, 255, (byte)alpha); newVertexColors[vertexIndex + 0] = c0; newVertexColors[vertexIndex + 1] = c0; newVertexColors[vertexIndex + 2] = c0; newVertexColors[vertexIndex + 3] = c0; // Push all updated vertex data to the appropriate meshes when using either the Mesh Renderer or CanvasRenderer. m_TextComponent.UpdateVertexData(TMP_VertexDataUpdateFlags.Colors32); } yield return(null); } c0 = new Color32(255, 255, 255, 0); newVertexColors[vertexIndex + 0] = c0; newVertexColors[vertexIndex + 1] = c0; newVertexColors[vertexIndex + 2] = c0; newVertexColors[vertexIndex + 3] = c0; // Push all updated vertex data to the appropriate meshes when using either the Mesh Renderer or CanvasRenderer. m_TextComponent.UpdateVertexData(TMP_VertexDataUpdateFlags.Colors32); // After all the characters have fully faded out. if (currentCharacter == 0 && fadeOutRightLeft || currentCharacter == textInfo.characterCount - 1) { // Set the TMP font settings color back to 1 in order to be able to set it back to 0, making the whole text invisible again; tmp.color = new Color(iniCol.r, iniCol.g, iniCol.b, 0); // To make sure the text stays warped after the complete fade in. if (warpScript && stayWarped) { // Stop the infinite animated warp loop. if (warpScript.warping) { warpScript.stopWarping = true; } // Make it warp one last time after the colors have been changed. warpScript.WarpText(); } textState = TextState.blank; lastCharacterDone = true; } // Keep setting their alpha value until the last character has faded out. while (!lastCharacterDone) { c0 = new Color32(255, 255, 255, 0); newVertexColors[vertexIndex + 0] = c0; newVertexColors[vertexIndex + 1] = c0; newVertexColors[vertexIndex + 2] = c0; newVertexColors[vertexIndex + 3] = c0; // Push all updated vertex data to the appropriate meshes when using either the Mesh Renderer or CanvasRenderer. m_TextComponent.UpdateVertexData(TMP_VertexDataUpdateFlags.Colors32); yield return(null); } yield return(null); }
static void blendPage(Document doc, Image foregroundImage, Image backgroundImage) { double height = 792; double width = 612; Rect pageRect = new Rect(0, 0, width, height); Page docpage = doc.CreatePage(doc.NumPages - 1, pageRect); // This section demonstrates all the Blend Modes one can achieve // by setting the BlendMode property to each of the 16 enumerations // on a foreground "ducky" over a background rainbow pattern, and // plopping all these images on a single page. Text t = new Text(); Font f; try { f = new Font("Arial", FontCreateFlags.Embedded | FontCreateFlags.Subset); } catch (ApplicationException ex) { if (ex.Message.Equals("The specified font could not be found.") && System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices .OSPlatform.Linux) && !System.IO.Directory.Exists("/usr/share/fonts/msttcore/")) { Console.WriteLine("Please install Microsoft Core Fonts on Linux first."); return; } throw; } GraphicState gsText = new GraphicState(); gsText.FillColor = new Color(0, 0, 1.0); TextState ts = new TextState(); for (int i = 0; i < 16; i++) { Image individualForegroundImage = foregroundImage.Clone(); Image individualBackgroundImage = backgroundImage.Clone(); GraphicState gs = individualForegroundImage.GraphicState; individualForegroundImage.Scale(0.125, 0.125); individualForegroundImage.Translate(800, 200 + height * (7 - i)); individualBackgroundImage.Scale(0.125, 0.125); individualBackgroundImage.Translate(800, 200 + height * (7 - i)); // Halfway through, create 2nd column by shifting over and up if (i > 7) { individualForegroundImage.Translate(2400, height * 8); individualBackgroundImage.Translate(2400, height * 8); } docpage.Content.AddElement(individualBackgroundImage); Console.WriteLine("Added background image " + (i + 1) + " to the content."); docpage.Content.AddElement(individualForegroundImage); Console.WriteLine("Added foreground image " + (i + 1) + " to the content."); Matrix m = new Matrix(); if (i > 7) { m = m.Translate(480, 750 - ((i - 8) * 100)); // second column } else { m = m.Translate(180, 750 - (i * 100)); // first column } m = m.Scale(12.0, 12.0); ExtendedGraphicState xgs = new ExtendedGraphicState(); TextRun tr = null; if (i == 0) { xgs.BlendMode = BlendMode.Normal; tr = new TextRun("Normal", f, gsText, ts, m); } else if (i == 1) { xgs.BlendMode = BlendMode.Multiply; tr = new TextRun("Multiply", f, gsText, ts, m); } else if (i == 2) { xgs.BlendMode = BlendMode.Screen; tr = new TextRun("Screen", f, gsText, ts, m); } else if (i == 3) { xgs.BlendMode = BlendMode.Overlay; tr = new TextRun("Overlay", f, gsText, ts, m); } else if (i == 4) { xgs.BlendMode = BlendMode.Darken; tr = new TextRun("Darken", f, gsText, ts, m); } else if (i == 5) { xgs.BlendMode = BlendMode.Lighten; tr = new TextRun("Lighten", f, gsText, ts, m); } else if (i == 6) { xgs.BlendMode = BlendMode.ColorDodge; tr = new TextRun("Color Dodge", f, gsText, ts, m); } else if (i == 7) { xgs.BlendMode = BlendMode.ColorBurn; tr = new TextRun("Color Burn", f, gsText, ts, m); } else if (i == 8) { xgs.BlendMode = BlendMode.HardLight; tr = new TextRun("Hard Light", f, gsText, ts, m); } else if (i == 9) { xgs.BlendMode = BlendMode.SoftLight; tr = new TextRun("SoftLight", f, gsText, ts, m); } else if (i == 10) { xgs.BlendMode = BlendMode.Difference; tr = new TextRun("Difference", f, gsText, ts, m); } else if (i == 11) { xgs.BlendMode = BlendMode.Exclusion; tr = new TextRun("Exclusion", f, gsText, ts, m); } else if (i == 12) { xgs.BlendMode = BlendMode.Hue; tr = new TextRun("Hue", f, gsText, ts, m); } else if (i == 13) { xgs.BlendMode = BlendMode.Saturation; tr = new TextRun("Saturation", f, gsText, ts, m); } else if (i == 14) { xgs.BlendMode = BlendMode.Color; tr = new TextRun("Color", f, gsText, ts, m); } else if (i == 15) { xgs.BlendMode = BlendMode.Luminosity; tr = new TextRun("Luminosity", f, gsText, ts, m); } t.AddRun(tr); docpage.Content.AddElement(t); docpage.UpdateContent(); Console.WriteLine("Updated the content on page 1."); gs.ExtendedGraphicState = xgs; individualForegroundImage.GraphicState = gs; Console.WriteLine("Set blend mode in extended graphic state."); } }
public override Status Layout(Area area) { if (!(area is BlockArea)) { FonetDriver.ActiveDriver.FireFonetError( "Text outside block area" + new String(ca, start, length)); return(new Status(Status.OK)); } if (this.marker == MarkerStart) { string fontFamily = this.parent.properties.GetProperty("font-family").GetString(); string fontStyle = this.parent.properties.GetProperty("font-style").GetString(); string fontWeight = this.parent.properties.GetProperty("font-weight").GetString(); int fontSize = this.parent.properties.GetProperty("font-size").GetLength().MValue(); int fontVariant = this.parent.properties.GetProperty("font-variant").GetEnum(); int letterSpacing = this.parent.properties.GetProperty("letter-spacing").GetLength().MValue(); this.fs = new FontState(area.getFontInfo(), fontFamily, fontStyle, fontWeight, fontSize, fontVariant, letterSpacing); ColorType c = this.parent.properties.GetProperty("color").GetColorType(); this.red = c.Red; this.green = c.Green; this.blue = c.Blue; this.verticalAlign = this.parent.properties.GetProperty("vertical-align").GetEnum(); this.wrapOption = this.parent.properties.GetProperty("wrap-option").GetEnum(); this.whiteSpaceCollapse = this.parent.properties.GetProperty("white-space-collapse").GetEnum(); this.ts = new TextState(); ts.setUnderlined(underlined); ts.setOverlined(overlined); ts.setLineThrough(lineThrough); this.marker = this.start; } int orig_start = this.marker; this.marker = addText((BlockArea)area, fs, red, green, blue, wrapOption, this.GetLinkSet(), whiteSpaceCollapse, ca, this.marker, length, ts, verticalAlign); if (this.marker == -1) { return(new Status(Status.OK)); } else if (this.marker != orig_start) { return(new Status(Status.AREA_FULL_SOME)); } else { return(new Status(Status.AREA_FULL_NONE)); } }
public static int addText(BlockArea ba, FontState fontState, float red, float green, float blue, int wrapOption, LinkSet ls, int whiteSpaceCollapse, char[] data, int start, int end, TextState textState, int vAlign) { if (fontState.FontVariant == FontVariant.SMALL_CAPS) { FontState smallCapsFontState; try { int smallCapsFontHeight = (int)(((double)fontState.FontSize) * 0.8d); smallCapsFontState = new FontState(fontState.FontInfo, fontState.FontFamily, fontState.FontStyle, fontState.FontWeight, smallCapsFontHeight, FontVariant.NORMAL); } catch (FonetException ex) { smallCapsFontState = fontState; FonetDriver.ActiveDriver.FireFonetError( "Error creating small-caps FontState: " + ex.Message); } char c; bool isLowerCase; int caseStart; FontState fontStateToUse; for (int i = start; i < end;) { caseStart = i; c = data[i]; isLowerCase = (Char.IsLetter(c) && Char.IsLower(c)); while (isLowerCase == (Char.IsLetter(c) && Char.IsLower(c))) { if (isLowerCase) { data[i] = Char.ToUpper(c); } i++; if (i == end) { break; } c = data[i]; } if (isLowerCase) { fontStateToUse = smallCapsFontState; } else { fontStateToUse = fontState; } int index = addRealText(ba, fontStateToUse, red, green, blue, wrapOption, ls, whiteSpaceCollapse, data, caseStart, i, textState, vAlign); if (index != -1) { return(index); } } return(-1); } return(addRealText(ba, fontState, red, green, blue, wrapOption, ls, whiteSpaceCollapse, data, start, end, textState, vAlign)); }
public ActionResult ExportPdf(List <GetTimeSheetModel> model) { List <List <TimeSheetModel> > timeSheets = new List <List <TimeSheetModel> >(); Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(); Page page = pdfDocument.Pages.Add(); page.PageInfo.IsLandscape = true; TextState tstate = new TextState(); tstate.FontSize = 10; page.PageInfo.DefaultTextState = tstate; MarginInfo marginInfo = new MarginInfo(); marginInfo.Left = 35; marginInfo.Right = 28; marginInfo.Top = 28; marginInfo.Bottom = 28; page.PageInfo.Margin = marginInfo; TextFragment text = new TextFragment("Time Sheets"); text.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center; text.TextState.FontSize = 16; text.Margin.Bottom = 20; page.Paragraphs.Add(text); List <Table> tableList = new List <Table>(); foreach (var item in model) { Table table = new Table { ColumnWidths = "80, 50, 65, 65, 60, 65, 50, 65, 50, 50, 65, 50", DefaultCellPadding = new MarginInfo(10, 5, 10, 5), Border = new BorderInfo(BorderSide.All, .5f, Color.Black), DefaultCellBorder = new BorderInfo(BorderSide.All, .2f, Color.Black), }; Aspose.Pdf.Row row1 = table.Rows.Add(); row1.Cells.Add("Time Sheet Key"); row1.Cells.Add("Type"); row1.Cells.Add("Start Time"); row1.Cells.Add("End Time"); row1.Cells.Add("Breaks"); row1.Cells.Add("Work Time"); row1.Cells.Add("m3"); row1.Cells.Add("Km - Stand"); row1.Cells.Add("Privat"); row1.Cells.Add("Fuel"); row1.Cells.Add("Ad Blue"); row1.Cells.Add("Notes"); foreach (var sheet in GetTimeSheetsByEmployeeIdAndDate(item)) { if (sheet.startTime != "-1" || sheet.endTime != "-1" || sheet.breaks != "-1") { Aspose.Pdf.Row row = table.Rows.Add(); row.Cells.Add(sheet.timeSheetKey == "-1" ? "" : sheet.timeSheetKey); row.Cells.Add(sheet.type == "-1" ? "" : sheet.type); row.Cells.Add(sheet.startTime == "-1" ? "" : sheet.startTime); row.Cells.Add(sheet.endTime == "-1" ? "" : sheet.endTime); row.Cells.Add(sheet.breaks == "-1" ? "" : sheet.breaks); row.Cells.Add(sheet.workTime == "-1" ? "" : sheet.workTime); row.Cells.Add(Convert.ToString(sheet.m3 == -1 ? 0 : sheet.m3)); row.Cells.Add(Convert.ToString(sheet.kmStand == -1 ? 0 : sheet.kmStand)); row.Cells.Add(Convert.ToString(sheet.privat == -1 ? 0 : sheet.privat)); row.Cells.Add(Convert.ToString(sheet.fuel == -1 ? 0 : sheet.fuel)); row.Cells.Add(Convert.ToString(sheet.adblue == -1 ? 0 : sheet.adblue)); row.Cells.Add(sheet.notes == "-1" ? "" : sheet.notes); } } tableList.Add(table); timeSheets.Add(GetTimeSheetsByEmployeeIdAndDate(item)); } foreach (var table in tableList) { pdfDocument.Pages[1].Paragraphs.Add(table); text = new TextFragment(""); text.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center; text.TextState.FontSize = 16; text.Margin.Bottom = 20; page.Paragraphs.Add(text); } using (var streamOut = new MemoryStream()) { pdfDocument.Save(streamOut); return(new FileContentResult(streamOut.ToArray(), "application/pdf")); } }
public IEnumerator ShowText(Name_ReplicaStruct text) { if (lastState != text.state || text.state == TextState.Special) { isTyping = true; StartCoroutine(Tools.MakeTransparent(characterImg, 0.5f, true)); StartCoroutine(Tools.MakeTransparent(textPanel, 0.5f, true)); StartCoroutine(Tools.MakeTransparentText(charName, 0.5f, true)); yield return(StartCoroutine(Tools.MakeTransparentText(replicaText, 0.5f, true))); if (text.name != CharactersName.StorryTeller) { string name = Enum.GetName(typeof(CharactersName), text.name); if (name.Contains("Unknown_")) { name = name.Substring(8); } characterImg.sprite = Resources.Load <Sprite>($"sprites/{name}/{name}_{Enum.GetName(typeof(CharacterEmotions), text.emotion)}"); } string path; if (text.replica.Length > 140) { path = ""; } else if (text.replica.Length <= 140 && text.replica.Length > 53) { path = "Medium"; } else { path = "Small"; } switch (text.state) { case TextState.Center: { characterImg.enabled = false; textPanel = GameObject.Find("ReplicaBGCenter" + path).GetComponent <Image>(); charName = textPanel.transform.GetChild(1).GetComponent <Text>(); replicaText = textPanel.transform.GetChild(0).GetComponent <Text>(); break; } case TextState.Left: { textPanel = GameObject.Find("ReplicaBGLeft" + path).GetComponent <Image>(); charName = textPanel.transform.GetChild(1).GetComponent <Text>(); replicaText = textPanel.transform.GetChild(0).GetComponent <Text>(); charName.text = text.NameToString(text.name); characterImg.rectTransform.anchoredPosition = new Vector2(-65, 150); characterImg.enabled = true; StartCoroutine(FlyCamera(2)); break; } case TextState.Right: { textPanel = GameObject.Find("ReplicaBGRight" + path).GetComponent <Image>(); charName = textPanel.transform.GetChild(1).GetComponent <Text>(); replicaText = textPanel.transform.GetChild(0).GetComponent <Text>(); charName.text = text.NameToString(text.name); characterImg.rectTransform.anchoredPosition = new Vector2(300, 150); characterImg.enabled = true; StartCoroutine(FlyCamera(1)); break; } case TextState.Special: { characterImg.enabled = false; text.ScriptEvent(); break; } } if (text.state != TextState.Special && text.state != TextState.NULL) { StartCoroutine(Tools.MakeTransparent(textPanel, 0.5f, false)); StartCoroutine(Tools.MakeTransparentText(replicaText, 0.5f, false)); StartCoroutine(Tools.MakeTransparentText(charName, 0.5f, false)); } } lastState = text.state; if (text.state != TextState.Special) { charName.text = text.NameToString(text.name); StartCoroutine(Tools.MakeTransparent(characterImg, 0.5f, false)); replicaText.text = text.replica; isTyping = false; } }
public static ComponentBuilder <TConfig, TTag> SetState <TConfig, TTag>(this ComponentBuilder <TConfig, TTag> builder, TextState state) where TConfig : BootstrapConfig where TTag : Tag { builder.Component.ToggleCss(state); return(builder); }
public TextEvent(TextState eventType) { this.eventType = eventType; }
public void NextStep(object o, System.EventArgs e) { timer.Stop(); state = savedState; }
public async Task SetTextState(TextState textState) { SetContextVariables(); presentation.TextState = textState; await Clients.OthersInGroup(groupName).SendAsync("SetTextState", presentation.TextState); }
private void createNode(HNode node, TextState parentTextState) { TextState nodeTextState = new TextState(); nodeTextState.ApplyChangesFrom(parentTextState); if (node is HNodeTag) { PUtil.TextStateUtil.TextState_ModifyFromHStyles((node as HNodeTag).Styles, nodeTextState); } // Block element if ((node is HNodeTag) && HUtil.TagUtil.IsBlockTag((node as HNodeTag).TagType)) { addTextFragmentOnPage(); createTextFragmentByTagType((node as HNodeTag).TagType); } // Inline element or Text element else if ( (node is HNodeTag) && HUtil.TagUtil.IsInlineTag((node as HNodeTag).TagType) || (node is HNodeText) ) { if ((node is HNodeText) && (node as HNodeText).ParentNode != null && ((node as HNodeText).ParentNode is HNodeTag) && (((node as HNodeText).ParentNode as HNodeTag)).TagType == HTagType.button) { // } else { // Create TextSegment for element TextSegment textSegment = getTextSegment(node, nodeTextState); // New Line, <BR /> if (pdfNewLine != null) { double marginTop = 0; double marginBottom = 0; if (pdfTextFragment != null) { marginBottom = pdfTextFragment.Margin.Bottom; pdfTextFragment.Margin.Bottom = 0; } addTextFragmentOnPage(); createTextFragmentByTagType(HTagType.div); if (pdfTextFragment != null) { pdfTextFragment.Margin.Top = marginTop; pdfTextFragment.Margin.Bottom = marginBottom; } pdfNewLine = null; } // Image else if (pdfImage != null) { double imageHeight = pdfImage.FixHeight; MarginInfo margin = new MarginInfo(0, 12, 0, 12); if (pdfTextFragment == null || pdfTextFragment.Segments.Count == 0 || (pdfTextFragment.Segments.Count == 1 && pdfTextFragment.Segments[1].Text == String.Empty)) { } else { pdfTextFragment.Margin.Top += imageHeight; margin = new MarginInfo(0, pdfTextFragment.Margin.Bottom, 0, -1 * imageHeight); } addTextFragmentOnPage(false); pdfImage.IsInLineParagraph = true; pdfImage.Margin = margin; inlineParagraphMargin = margin; if (hyperlinkNode != null) { Aspose.Pdf.WebHyperlink pdfHyperlink = new WebHyperlink(hyperlinkNode.GetAttribute("href", "#")); pdfImage.Hyperlink = pdfHyperlink; } pdfPage.Paragraphs.Add(pdfImage); if (node.NextNode == null) { updateCurrentPage(); } pdfImage = null; } // Form Field Element else if (pdfFormField != null) { // // // double inputHeight = pdfFormField.Height; MarginInfo margin = new MarginInfo(0, 12, 0, 12); if (pdfTextFragment == null || pdfTextFragment.Segments.Count == 0 || (pdfTextFragment.Segments.Count == 1 && pdfTextFragment.Segments[1].Text == String.Empty)) { } else { double textFragmentHeight = pdfTextFragment.Rectangle.Height; margin = pdfTextFragment.Margin; pdfTextFragment.Margin.Bottom = textFragmentHeight - inputHeight; pdfTextFragment.Margin.Top += Math.Max(0, (inputHeight - textFragmentHeight)); pdfTextFragment.Margin.Top += inputHeight; } addTextFragmentOnPage(false); pdfFormField.IsInLineParagraph = true; pdfFormField.Margin = margin; inlineParagraphMargin = new MarginInfo(pdfFormField.Width, margin.Bottom, margin.Right, margin.Top); pdfPage.Paragraphs.Add(pdfFormField); if (node.NextNode == null) { updateCurrentPage(); } pdfFormField = null; } // TextFragment for InLineParagraph mode else if (pdfTextFragment == null) { HTagType tagTypeForTextFragment = HTagType.div; bool isInLineParagraphForTextFragment = false; bool flagPreviousImage = false; bool flagPreviousInput = false; if (node.PrevNode != null && (node.PrevNode is HNodeTag) && (node.PrevNode as HNodeTag).TagType == HTagType.img) { // prev image element if (node.ParentNode != null && (node.ParentNode is HNodeTag) && HUtil.TagUtil.IsBlockTag((node.ParentNode as HNodeTag).TagType)) { tagTypeForTextFragment = (node.ParentNode as HNodeTag).TagType; } isInLineParagraphForTextFragment = true; flagPreviousImage = true; } else if (node.PrevNode != null && (node.PrevNode is HNodeTag) && (node.PrevNode as HNodeTag).TagType == HTagType.input) { // prev input element if (node.ParentNode != null && (node.ParentNode is HNodeTag) && HUtil.TagUtil.IsBlockTag((node.ParentNode as HNodeTag).TagType)) { tagTypeForTextFragment = (node.ParentNode as HNodeTag).TagType; } isInLineParagraphForTextFragment = true; flagPreviousInput = true; } else { } createTextFragmentByTagType(tagTypeForTextFragment); pdfTextFragment.IsInLineParagraph = isInLineParagraphForTextFragment; if ((flagPreviousImage || flagPreviousInput) && inlineParagraphMargin != null) { pdfTextFragment.Margin.Top = -1 * pdfTextFragment.Rectangle.Height - inlineParagraphMargin.Bottom; pdfTextFragment.Margin.Bottom = inlineParagraphMargin.Bottom; pdfTextFragment.Margin.Left = inlineParagraphMargin.Left; inlineParagraphMargin = null; } } if (textSegment != null && pdfTextFragment != null) //if (textSegment != null) { pdfTextFragment.Segments.Add(textSegment); } } } // // Create Nodes recursively with consider the hyperlink // if ((node is HNodeTag) && (node as HNodeTag).TagType == HTagType.a) { hyperlinkNode = (node as HNodeTag); } if (node is HNodeContainer) { foreach (HNode childNode in (node as HNodeContainer).ChildNodes) { createNode(childNode, nodeTextState); } } if ((node is HNodeTag) && (node as HNodeTag).TagType == HTagType.a) { hyperlinkNode = null; } // // // // // Add Text Fragment on Page (if need) // if ((node is HNodeTag) && HUtil.TagUtil.IsBlockTag((node as HNodeTag).TagType)) { addTextFragmentOnPage(); } // // // }
internal void LoadState(TextState<TextStateData> s) { s.Prepare(); var ff = s.GetFunctionPointersLoad(); LibGambatte.gambatte_newstateload_ex(GambatteState, ref ff); IsLagFrame = s.ExtraData.IsLagFrame; LagCount = s.ExtraData.LagCount; Frame = s.ExtraData.Frame; frameOverflow = s.ExtraData.frameOverflow; _cycleCount = s.ExtraData._cycleCount; }
private TextSegment getTextSegment(HNode node, TextState parentTextState) { TextSegment textSegment = null; // Text element if (node is HNodeText) { textSegment = new TextSegment(); textSegment.TextState = parentTextState; textSegment.Text = (node as HNodeText).Text; if (hyperlinkNode != null) { Aspose.Pdf.WebHyperlink pdfHyperlink = new WebHyperlink(hyperlinkNode.GetAttribute("href", "#")); textSegment.Hyperlink = pdfHyperlink; } } // New Line element <br /> if ((node is HNodeTag) && (node as HNodeTag).TagType == HTagType.br) { /* * //слетают стили!!! * textSegment = new TextSegment(); * //textSegment.TextState = parentTextState; * textSegment.Text = Environment.NewLine; */ pdfNewLine = new TextSegment(); pdfNewLine.Text = Environment.NewLine; } // Hyperlink element <a> if ((node is HNodeTag) && (node as HNodeTag).TagType == HTagType.a) { PUtil.TextStateUtil.TextState_ModifyForHyperlink(parentTextState); PUtil.TextStateUtil.TextState_ModifyFromHStyles((node as HNodeTag).Styles, parentTextState); } // Bold text element <b> if ((node is HNodeTag) && (node as HNodeTag).TagType == HTagType.b) { PUtil.TextStateUtil.TextState_ModifyForBold(parentTextState); PUtil.TextStateUtil.TextState_ModifyFromHStyles((node as HNodeTag).Styles, parentTextState); } // Italic text element <i> if ((node is HNodeTag) && (node as HNodeTag).TagType == HTagType.i) { PUtil.TextStateUtil.TextState_ModifyForItalic(parentTextState); PUtil.TextStateUtil.TextState_ModifyFromHStyles((node as HNodeTag).Styles, parentTextState); } // Image element <img> if ((node is HNodeTag) && (node as HNodeTag).TagType == HTagType.img) { pdfImage = getImage(node as HNodeTag); } // Form field element <input> if ((node is HNodeTag) && (node as HNodeTag).TagType == HTagType.input) { pdfFormField = getFormField(node as HNodeTag); } // Button element <button> if ((node is HNodeTag) && (node as HNodeTag).TagType == HTagType.button) { pdfFormField = getFormFieldButton(node as HNodeTag); } // TODO - other inline tags return(textSegment); }
static void Main(string[] args) { Console.WriteLine("RepeatingFormXObject Sample:"); int repeatMax = 100; // Record count... string customerInfoFont = "Garamond"; double customerInfoPointSize = 10.0; string transactionDataFont = "Arial"; double transactionDataPointSize = 10.0; double transactionData_xPos = 0; double transactionData_yStartPos = 0; double transactionData_leading = 27; double transactionData_count = 0; // Populate some customer transaction data. This could be read from a CSV or XML file or other source, one per customer. // But for this sample, we will just insert it here. // Could pass in position data as well. customerInfo customer1 = new customerInfo("Acme, Inc", "123 Main Street", "New York", "NY", "54321", "1 (800) 555-1212"); transactionData transaction1 = new transactionData("01/03/2020", "Balance Forward", 50.00, 0, 50.00); transactionData transaction2 = new transactionData("01/13/2020", "Water", 20.00, 0, 70.00); transactionData transaction3 = new transactionData("01/22/2020", "Electric", 110.00, 0, 180.00); transactionData transaction4 = new transactionData("02/03/2020", "Cable", 0, 40.00, 140.00); transactionData transaction5 = new transactionData("02/06/2020", "Phone", 50.00, 0, 190.00); var sw = Stopwatch.StartNew(); using (Library lib = new Library()) { Console.WriteLine("Initialized the library."); String sTemplate = Library.ResourceDirectory + "Sample_Input/DuckyAccountStatement.pdf"; String sOutput = "../RepeatingForm-out-" + repeatMax + ".pdf"; if (args.Length > 0) { sOutput = args[0]; } Console.WriteLine("Output file: " + sOutput); // Setup the Form... the boilerplate portion that is repeated on each page. // For this example, we will pull this from another PDF document. // Alternatively, the application could create the appropriate Text, Path and Image elements // and add them to Form Content. Document sourceDoc = new Document(sTemplate); Page sourcePage = sourceDoc.GetPage(0); // get the first page Form templateForm = new Form(sourcePage.Content); // Create the output document Document doc = new Document(); Font fC = new Font(customerInfoFont, FontCreateFlags.Embedded | FontCreateFlags.Subset); // will embed the font Font fT = new Font(transactionDataFont, FontCreateFlags.Embedded | FontCreateFlags.Subset); GraphicState gs = new GraphicState(); TextState ts = new TextState(); Matrix m = new Matrix(); gs.FillColor = new Color(0.0); // DeviceGray colorspace (black) Rect pageRect = new Rect(0, 0, 612, 792); for (int i = 1; i <= repeatMax; i++) { if ((i % 10000) == 0) { // Every 10K, output the timer Console.WriteLine("Processing record " + i); Console.WriteLine("Time elapsed: " + sw.ElapsedMilliseconds + " milliseconds."); } Page docpage = doc.CreatePage(Document.LastPage, pageRect); // add the template to the page docpage.Content.AddElement(templateForm); // add the unique content per page Text t = new Text(); // call for each customer. Only 1 for the sample DisplayCustomerInfo(customer1, ref t, fC, gs, ts, customerInfoPointSize); // transaction data - for the sample, transaction data is in fixed positions. // We'll pass the start x and y. Each row is about 27 points below the prior row. // Limited to 5 rows for this template. ProcessTransaction(transaction1, 37, 450, ref t, fT, gs, ts, transactionDataPointSize); ProcessTransaction(transaction2, 37, 423, ref t, fT, gs, ts, transactionDataPointSize); ProcessTransaction(transaction3, 37, 396, ref t, fT, gs, ts, transactionDataPointSize); ProcessTransaction(transaction4, 37, 369, ref t, fT, gs, ts, transactionDataPointSize); ProcessTransaction(transaction5, 37, 342, ref t, fT, gs, ts, transactionDataPointSize); // Add document number at bottom of each page m = new Matrix().Translate(475, 115).Scale(11.0, 11.0); TextRun tr = new TextRun("Document: " + i.ToString(), fC, gs, ts, m); t.AddRun(tr); docpage.Content.AddElement(t); docpage.UpdateContent(); // Update the PDF page with the changed content tr.Dispose(); t.Dispose(); docpage.Dispose(); } doc.EmbedFonts(EmbedFlags.None); doc.Save(SaveFlags.Full, sOutput); // Dispose of things templateForm.Dispose(); sourcePage.Dispose(); sourceDoc.Dispose(); doc.Dispose(); } sw.Stop(); TimeSpan timeElapsed = sw.Elapsed; Console.WriteLine("Document closed and saved. Total time elapsed: " + timeElapsed.TotalSeconds + " seconds"); Console.WriteLine(" or " + repeatMax / timeElapsed.TotalSeconds + " pages per second"); }
public TextSegment(string text, TextState textState) { this.Text = text; this.Type = textState; }
static void Main(string[] args) { Console.WriteLine("AddUnicodeText Sample:"); // ReSharper disable once UnusedVariable using (Library lib = new Library()) { Console.WriteLine("Initialized the library."); String sOutput = "AddUnicodeText-out.pdf"; if (args.Length > 0) { sOutput = args[0]; } Console.WriteLine("Output file: " + sOutput); Document doc = new Document(); Rect pageRect = new Rect(0, 0, 612, 792); Page docpage = doc.CreatePage(Document.BeforeFirstPage, pageRect); Text unicodeText = new Text(); GraphicState gs = new GraphicState(); TextState ts = new TextState(); List <String> strings = new List <String>(); strings.Add("Chinese (Mandarin) - \u4e16\u754c\u4eba\u6743\u5ba3\u8a00"); strings.Add("Japanese - \u300e\u4e16\u754c\u4eba\u6a29\u5ba3\u8a00\u300f"); strings.Add("French - \u0044\u00e9\u0063\u006c\u0061\u0072\u0061\u0074\u0069\u006f\u006e" + "\u0020\u0075\u006e\u0069\u0076\u0065\u0072\u0073\u0065\u006c\u006c\u0065\u0020\u0064" + "\u0065\u0073\u0020\u0064\u0072\u006f\u0069\u0074\u0073\u0020\u0064\u0065\u0020\u006c" + "\u2019\u0068\u006f\u006d\u006d\u0065"); strings.Add("Korean - \uc138\u0020\uacc4\u0020\uc778\u0020\uad8c\u0020\uc120\u0020\uc5b8"); strings.Add("English - \u0055\u006e\u0069\u0076\u0065\u0072\u0073\u0061\u006c\u0020\u0044" + "\u0065\u0063\u006c\u0061\u0072\u0061\u0074\u0069\u006f\u006e\u0020\u006f\u0066\u0020" + "\u0048\u0075\u006d\u0061\u006e\u0020\u0052\u0069\u0067\u0068\u0074\u0073"); strings.Add("Greek - \u039f\u0399\u039a\u039f\u03a5\u039c\u0395\u039d\u0399\u039a\u0397\u0020" + "\u0394\u0399\u0391\u039a\u0397\u03a1\u03a5\u039e\u0397\u0020\u0393\u0399\u0391\u0020" + "\u03a4\u0391\u0020\u0391\u039d\u0398\u03a1\u03a9\u03a0\u0399\u039d\u0391\u0020\u0394" + "\u0399\u039a\u0391\u0399\u03a9\u039c\u0391\u03a4\u0391"); strings.Add("Russian - \u0412\u0441\u0435\u043e\u0431\u0449\u0430\u044f\u0020\u0434\u0435" + "\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u044f\u0020\u043f\u0440\u0430\u0432\u0020" + "\u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430"); List <Font> fonts = new List <Font>(); try { fonts.Add(new Font("Arial")); } catch (ApplicationException ex) { if (ex.Message.Equals("The specified font could not be found.") && System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices .OSPlatform.Linux) && !System.IO.Directory.Exists("/usr/share/fonts/msttcore/")) { Console.WriteLine("Please install Microsoft Core Fonts on Linux first."); return; } throw; } fonts.Add(new Font("KozGoPr6N-Medium")); fonts.Add(new Font("AdobeMyungjoStd-Medium")); // These will be used to place the strings into position on the page. int x = 1 * 72; int y = 10 * 72; foreach (String str in strings) { // Find a font that can represent all characters in the string, if there is one. Font font = GetRepresentableFont(fonts, str); if (font == null) { Console.WriteLine( "Couldn't find a font that can represent all characters in the string: " + str); } else { // From this point, the string is handled the same way as non-Unicode text. Matrix m = new Matrix(14, 0, 0, 14, x, y); TextRun tr = new TextRun(font.Name + " - " + str, font, gs, ts, m); unicodeText.AddRun(tr); } // Start the next string lower down the page. y -= 18; } docpage.Content.AddElement(unicodeText); docpage.UpdateContent(); // Save the document. Console.WriteLine("Embedding fonts."); doc.EmbedFonts(EmbedFlags.None); doc.Save(SaveFlags.Full, sOutput); } }
void Update() { //Phtext m_WaterText.text = m_ph.ToString(); //PhBar if (m_ph < 25 || m_ph > -25) { m_phBar.transform.position = new Vector2(m_phBar.transform.position.x, m_ph / 8f); } //random water generator if (m_waterTimer < 0) { //Change the amplitude m_amplitude = Random.Range(-15, 15); m_ph += m_amplitude; m_waterTimer = m_startWaterTimer; //Reset bars m_potionSlot.m_pBarFilled = false; m_potionSlot.m_nBarFilled = false; } else { m_waterTimer -= Time.deltaTime; } #region Lose requirement if (m_ph >= 25) { m_ph = 25; Debug.Log("You lose"); } else if (m_ph <= -25) { m_ph = -25; Debug.Log("You lose"); } #endregion //Check water state if (m_ph >= 14) { m_InBalans.SetActive(false); m_tooHigh.SetActive(true); m_tooLow.SetActive(false); m_textState = TextState.tooPositive; if (m_ph <= 20) { m_state = WaterState.beetjeVies; } else { m_state = WaterState.redelijkVies; } } else if (m_ph <= -12) { m_InBalans.SetActive(false); m_tooHigh.SetActive(false); m_tooLow.SetActive(true); m_textState = TextState.tooNegative; if (m_ph <= 20) { m_state = WaterState.redelijkVies; } else { m_state = WaterState.ergVies; } } else { m_InBalans.SetActive(true); m_tooHigh.SetActive(false); m_tooLow.SetActive(false); m_state = WaterState.schoon; } //Animator State m_UpperWater.SetFloat("WaterState", m_waterState); m_LowerWater.SetFloat("WaterState", m_waterState); if (m_state == WaterState.schoon) { m_waterState = 0f; } else if (m_state == WaterState.beetjeVies) { m_waterState = 1f; } else if (m_state == WaterState.redelijkVies) { m_waterState = 2f; } else if (m_state == WaterState.ergVies) { m_waterState = 3f; } }
public TextState getTextDecoration(FObj parent) { TextState tsp = null; bool found = false; do { switch (parent.ElementName) { case "fo:flow": case "fo:static-content": found = true; break; case "fo:block": case "fo:inline": FObjMixed fom = (FObjMixed)parent; tsp = fom.getTextState(); found = true; break; } parent = parent.getParent(); } while (!found); TextState ts = new TextState(); if (tsp != null) { ts.setUnderlined(tsp.getUnderlined()); ts.setOverlined(tsp.getOverlined()); ts.setLineThrough(tsp.getLineThrough()); } TextDecoration textDecoration = this.properties.GetTextDecoration(); switch (this.properties.GetTextDecoration()) { case TextDecoration.UNDERLINE: ts.setUnderlined(true); break; case TextDecoration.OVERLINE: ts.setOverlined(true); break; case TextDecoration.LINE_THROUGH: ts.setLineThrough(true); break; case TextDecoration.NO_UNDERLINE: ts.setUnderlined(false); break; case TextDecoration.NO_OVERLINE: ts.setOverlined(false); break; case TextDecoration.NO_LINE_THROUGH: ts.setLineThrough(false); break; } return(ts); }
/// <summary> /// This feature is supported by version 19.6 or greater /// </summary> public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); // Create document Document document = new Document(); ITaggedContent taggedContent = document.TaggedContent; taggedContent.SetTitle("Example table"); taggedContent.SetLanguage("en-US"); // Get root structure element StructureElement rootElement = taggedContent.RootElement; TableElement tableElement = taggedContent.CreateTableElement(); rootElement.AppendChild(tableElement); tableElement.Border = new BorderInfo(BorderSide.All, 1.2F, Color.DarkBlue); TableTHeadElement tableTHeadElement = tableElement.CreateTHead(); TableTBodyElement tableTBodyElement = tableElement.CreateTBody(); TableTFootElement tableTFootElement = tableElement.CreateTFoot(); int rowCount = 50; int colCount = 4; int rowIndex; int colIndex; TableTRElement headTrElement = tableTHeadElement.CreateTR(); headTrElement.AlternativeText = "Head Row"; headTrElement.BackgroundColor = Color.LightGray; for (colIndex = 0; colIndex < colCount; colIndex++) { TableTHElement thElement = headTrElement.CreateTH(); thElement.SetText(String.Format("Head {0}", colIndex)); thElement.BackgroundColor = Color.GreenYellow; thElement.Border = new BorderInfo(BorderSide.All, 4.0F, Color.Gray); thElement.IsNoBorder = true; thElement.Margin = new MarginInfo(16.0, 2.0, 8.0, 2.0); thElement.Alignment = HorizontalAlignment.Right; } for (rowIndex = 0; rowIndex < rowCount; rowIndex++) { TableTRElement trElement = tableTBodyElement.CreateTR(); trElement.AlternativeText = String.Format("Row {0}", rowIndex); for (colIndex = 0; colIndex < colCount; colIndex++) { int colSpan = 1; int rowSpan = 1; if (colIndex == 1 && rowIndex == 1) { colSpan = 2; rowSpan = 2; } else if (colIndex == 2 && (rowIndex == 1 || rowIndex == 2)) { continue; } else if (rowIndex == 2 && (colIndex == 1 || colIndex == 2)) { continue; } TableTDElement tdElement = trElement.CreateTD(); tdElement.SetText(String.Format("Cell [{0}, {1}]", rowIndex, colIndex)); tdElement.BackgroundColor = Color.Yellow; tdElement.Border = new BorderInfo(BorderSide.All, 4.0F, Color.Gray); tdElement.IsNoBorder = false; tdElement.Margin = new MarginInfo(8.0, 2.0, 8.0, 2.0); tdElement.Alignment = HorizontalAlignment.Center; TextState cellTextState = new TextState(); cellTextState.ForegroundColor = Color.DarkBlue; cellTextState.FontSize = 7.5F; cellTextState.FontStyle = FontStyles.Bold; cellTextState.Font = FontRepository.FindFont("Arial"); tdElement.DefaultCellTextState = cellTextState; tdElement.IsWordWrapped = true; tdElement.VerticalAlignment = VerticalAlignment.Center; tdElement.ColSpan = colSpan; tdElement.RowSpan = rowSpan; } } TableTRElement footTrElement = tableTFootElement.CreateTR(); footTrElement.AlternativeText = "Foot Row"; footTrElement.BackgroundColor = Color.LightSeaGreen; for (colIndex = 0; colIndex < colCount; colIndex++) { TableTDElement tdElement = footTrElement.CreateTD(); tdElement.SetText(String.Format("Foot {0}", colIndex)); tdElement.Alignment = HorizontalAlignment.Center; tdElement.StructureTextState.FontSize = 7F; tdElement.StructureTextState.FontStyle = FontStyles.Bold; } StructureAttributes tableAttributes = tableElement.Attributes.GetAttributes(AttributeOwnerStandard.Table); StructureAttribute summaryAttribute = new StructureAttribute(AttributeKey.Summary); summaryAttribute.SetStringValue("The summary text for table"); tableAttributes.SetAttribute(summaryAttribute); // Save Tagged Pdf Document document.Save(dataDir + "CreateTableElement.pdf"); // Checking PDF/UA compliance document = new Document(dataDir + "CreateTableElement.pdf"); bool isPdfUaCompliance = document.Validate(dataDir + "table.xml", PdfFormat.PDF_UA_1); Console.WriteLine(String.Format("PDF/UA compliance: {0}", isPdfUaCompliance)); // ExEnd:1 }
public void Reset() { textState = TextState.blank; // Set the alpha to 0 while keeping its RGB values the same. tmp.color = new Color(iniCol.r, iniCol.g, iniCol.b, 0); }
void NextText() { this.SetText(); this.currentTextState = TextState.DISPLAYING; }
void WrongPick(object o, System.EventArgs e) { timer.Stop(); state = savedState; updateSprite = THINK; }
private void OnDisable() { transform.localScale = Vector3.one * scaleFactor * 1f / 10f; textState = TextState.EnableScreen; disappearTime = disappearTimeOrigin; }
public void WrongObject() { savedState = state; state = TextState.WRONG_OBJ; }
/// <summary> /// 文字を点滅させる /// </summary> public void FlashText() { textState = TextState.Flash; }
public ActionResult TenantsToPDF() { var tenants = GenerateListOfTenants(); // Create new a PDF document var document = new Document { PageInfo = new PageInfo { Margin = new MarginInfo(28, 28, 28, 42) } }; var pdfPage = document.Pages.Add(); // Initializes a new instance of the TextFragment for report's title var textFragment = new TextFragment(reportTitle1); // Set text properties textFragment.TextState.FontSize = 12; textFragment.TextState.Font = FontRepository.FindFont("TimesNewRoman"); textFragment.TextState.FontStyle = FontStyles.Bold; // Initializes a new instance of the Table Table table = new Table { // Set column auto widths of the table ColumnWidths = "10 10 10 10 10 10", ColumnAdjustment = ColumnAdjustment.AutoFitToContent, // Set cell padding DefaultCellPadding = new MarginInfo(5, 5, 5, 5), // Set the table border color as Black Border = new BorderInfo(BorderSide.All, .5f, Color.Black), // Set the border for table cells as Black DefaultCellBorder = new BorderInfo(BorderSide.All, .2f, Color.Black), }; table.DefaultCellTextState = new TextState("TimesNewRoman", 10); var paymentFormat = new TextState("TimesNewRoman", 10) { HorizontalAlignment = HorizontalAlignment.Right }; table.SetColumnTextState(5, paymentFormat); table.ImportEntityList(tenants); //Repeat Header table.RepeatingRowsCount = 1; // Add text fragment object to first page of input document pdfPage.Paragraphs.Add(textFragment); // Add table object to first page of input document pdfPage.Paragraphs.Add(table); using (var streamOut = new MemoryStream()) { document.Save(streamOut); return(new FileContentResult(streamOut.ToArray(), "application/pdf") { FileDownloadName = "tenants.pdf" }); } }
public static TThis SetState <THelper, TThis, TWrapper>(this Component <THelper, TThis, TWrapper> component, TextState state) where THelper : BootstrapHelper <THelper> where TThis : Tag <THelper, TThis, TWrapper> where TWrapper : TagWrapper <THelper>, new() { return(component.GetThis().ToggleCss(state)); }
public void SaveStateText(TextWriter writer) { var s = new TextState<TextStateData>(); s.Prepare(); var ff = s.GetFunctionPointersSave(); BizSwan.bizswan_txtstatesave(Core, ref ff); s.ExtraData.IsLagFrame = IsLagFrame; s.ExtraData.LagCount = LagCount; s.ExtraData.Frame = Frame; ser.Serialize(writer, s); // write extra copy of stuff we don't use writer.WriteLine(); writer.WriteLine("Frame {0}", Frame); // debug //Console.WriteLine(Util.Hash_SHA1(SaveStateBinary())); }
static void Main(string[] args) { Console.WriteLine("AddUnicodeText Sample:"); using (Library lib = new Library()) { Console.WriteLine("Initialized the library."); String sOutput = "../AddUnicodeText-out.pdf"; if (args.Length > 0) { sOutput = args[0]; } Console.WriteLine("Output file: " + sOutput); Document doc = new Document(); Rect pageRect = new Rect(0, 0, 612, 792); Page docpage = doc.CreatePage(Document.BeforeFirstPage, pageRect); Text unicodeText = new Text(); GraphicState gs = new GraphicState(); TextState ts = new TextState(); List <String> strings = new List <String>(); strings.Add("Chinese (Mandarin) - \u4e16\u754c\u4eba\u6743\u5ba3\u8a00"); strings.Add("Japanese - \u300e\u4e16\u754c\u4eba\u6a29\u5ba3\u8a00\u300f"); strings.Add("French - \u0044\u00e9\u0063\u006c\u0061\u0072\u0061\u0074\u0069\u006f\u006e\u0020\u0075\u006e\u0069\u0076\u0065\u0072\u0073\u0065\u006c\u006c\u0065\u0020\u0064\u0065\u0073\u0020\u0064\u0072\u006f\u0069\u0074\u0073\u0020\u0064\u0065\u0020\u006c\u2019\u0068\u006f\u006d\u006d\u0065"); strings.Add("Korean - \uc138\u0020\uacc4\u0020\uc778\u0020\uad8c\u0020\uc120\u0020\uc5b8"); strings.Add("English - \u0055\u006e\u0069\u0076\u0065\u0072\u0073\u0061\u006c\u0020\u0044\u0065\u0063\u006c\u0061\u0072\u0061\u0074\u0069\u006f\u006e\u0020\u006f\u0066\u0020\u0048\u0075\u006d\u0061\u006e\u0020\u0052\u0069\u0067\u0068\u0074\u0073"); strings.Add("Greek - \u039f\u0399\u039a\u039f\u03a5\u039c\u0395\u039d\u0399\u039a\u0397\u0020\u0394\u0399\u0391\u039a\u0397\u03a1\u03a5\u039e\u0397\u0020\u0393\u0399\u0391\u0020\u03a4\u0391\u0020\u0391\u039d\u0398\u03a1\u03a9\u03a0\u0399\u039d\u0391\u0020\u0394\u0399\u039a\u0391\u0399\u03a9\u039c\u0391\u03a4\u0391"); strings.Add("Russian - \u0412\u0441\u0435\u043e\u0431\u0449\u0430\u044f\u0020\u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u044f\u0020\u043f\u0440\u0430\u0432\u0020\u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430"); List <Font> fonts = new List <Font>(); fonts.Add(new Font("Arial")); fonts.Add(new Font("KozGoPr6N-Medium")); fonts.Add(new Font("AdobeMyungjoStd-Medium")); // These will be used to place the strings into position on the page. int x = 1 * 72; int y = 10 * 72; foreach (String str in strings) { // Find a font that can represent all characters in the string, if there is one. Font font = GetRepresentableFont(fonts, str); if (font == null) { Console.WriteLine("Couldn't find a font that can represent all characters in the string: " + str); } else { // From this point, the string is handled the same way as non-Unicode text. Matrix m = new Matrix(14, 0, 0, 14, x, y); TextRun tr = new TextRun(font.Name + " - " + str, font, gs, ts, m); unicodeText.AddRun(tr); } // Start the next string lower down the page. y -= 18; } docpage.Content.AddElement(unicodeText); docpage.UpdateContent(); // Save the document. Console.WriteLine("Embedding fonts."); doc.EmbedFonts(EmbedFlags.None); doc.Save(SaveFlags.Full, sOutput); } }
static void DisplayCustomerInfo(customerInfo customer, ref Text t, Font f, GraphicState gs, TextState ts, double pointSize) { Matrix m1 = new Matrix().Translate(customer.name_x, customer.name_y).Scale(pointSize, pointSize); // customerInfoPointSize TextRun tr1 = new TextRun(customer.name, f, gs, ts, m1); t.AddRun(tr1); m1 = new Matrix().Translate(customer.address_x, customer.address_y).Scale(pointSize, pointSize); tr1 = new TextRun(customer.address, f, gs, ts, m1); t.AddRun(tr1); m1 = new Matrix().Translate(customer.city_x, customer.city_y).Scale(pointSize, pointSize); String s = customer.city + ", " + customer.state + " " + customer.zip; tr1 = new TextRun(s, f, gs, ts, m1); t.AddRun(tr1); m1 = new Matrix().Translate(customer.phone_x, customer.phone_y).Scale(pointSize, pointSize); tr1 = new TextRun(customer.phone, f, gs, ts, m1); t.AddRun(tr1); m1.Dispose(); tr1.Dispose(); }
static void ProcessTransaction(transactionData transaction, double x, double y, ref Text t, Font f, GraphicState gs, TextState ts, double pointSize) { // The x position of the five elements of a transaction are // Date 37 9x) Descriprtion 132 (x+95) Charges 267 (x+230) Credits 360 (x+323) Balance 450 (x+413) Matrix m = new Matrix().Translate(x, y).Scale(pointSize, pointSize); TextRun tr = new TextRun(transaction.date, f, gs, ts, m); t.AddRun(tr); m = new Matrix().Translate(x + 95, y).Scale(pointSize, pointSize); tr = new TextRun(transaction.description, f, gs, ts, m); t.AddRun(tr); m = new Matrix().Translate(x + 230, y).Scale(pointSize, pointSize); tr = new TextRun(transaction.charges.ToString(), f, gs, ts, m); t.AddRun(tr); m = new Matrix().Translate(x + 323, y).Scale(pointSize, pointSize); tr = new TextRun(transaction.credit.ToString(), f, gs, ts, m); t.AddRun(tr); m = new Matrix().Translate(x + 413, y).Scale(pointSize, pointSize); tr = new TextRun(transaction.balance.ToString(), f, gs, ts, m); t.AddRun(tr); }
internal TextState<TextStateData> SaveState() { var s = new TextState<TextStateData>(); s.Prepare(); var ff = s.GetFunctionPointersSave(); LibGambatte.gambatte_newstatesave_ex(GambatteState, ref ff); s.ExtraData.IsLagFrame = IsLagFrame; s.ExtraData.LagCount = LagCount; s.ExtraData.Frame = Frame; s.ExtraData.frameOverflow = frameOverflow; s.ExtraData._cycleCount = _cycleCount; return s; }
public void SaveStateText(System.IO.TextWriter writer) { var s = new TextState<TextStateData>(); s.Prepare(); var ff = s.GetFunctionPointersSave(); LibGambatte.gambatte_newstatesave_ex(GambatteState, ref ff); s.ExtraData.IsLagFrame = IsLagFrame; s.ExtraData.LagCount = LagCount; s.ExtraData.Frame = Frame; s.ExtraData.frameOverflow = frameOverflow; s.ExtraData._cycleCount = _cycleCount; ser.Serialize(writer, s); // write extra copy of stuff we don't use writer.WriteLine(); writer.WriteLine("Frame {0}", Frame); }