static void ShowTextCount() { targetObj = Selection.activeGameObject;//得到选中对象 if (targetObj) { bool isok = false; chindernList.Clear(); GetAllTransform(targetObj.transform);//递归得到所有的子对象 for (int i = 0; i < chindernList.Count; i++) { //获取obj,并保存 UILabel _Text = null; if ((_Text = chindernList[i].GetComponent <UILabel>()) && (_Text.bitmapFont) && (_Text.bitmapFont.name == ChangeFont1 || _Text.bitmapFont.name == ChangeFont2)) { waiteForUpdate.Add(chindernList[i].GetComponent <UILabel>()); isok = true; } } if (isok) { if (!targetObj.GetComponent <SetFont>()) { targetObj.AddComponent <SetFont>(); } SetFont set = targetObj.GetComponent <SetFont>();//为对象添加个组件 set.UpdateFont(waiteForUpdate); chindernList.Clear(); waiteForUpdate.Clear(); GameObject.DestroyImmediate(targetObj.GetComponent <SetFont>());//修改完毕移除组件 } } }
// Token: 0x06000005 RID: 5 RVA: 0x00002180 File Offset: 0x00000380 private static void Postfix(SetFont __instance) { Font mfont = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font; if (!Main.enabled) { return; } string name = __instance.name; Text component = __instance.GetComponent <Text>(); int change = component.fontSize + Main.settings.fontSizeChange; component.font = mfont; if (GameObjectConstant.Check(name)) { component.fontSize = change; } }
/// <summary> /// Sets the font and property for all pages/Sections And others /// </summary> /// <param name="fnt">Font Choice</param> internal void SetFontValue(SetFont fnt) { Font = fnt; switch (Font) { case SetFont.MSSANS10: GetFont = new System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Regular); break; case SetFont.MSSANS11: GetFont = new System.Drawing.Font("Microsoft Sans Serif", 11, FontStyle.Regular); break; case SetFont.MSSANS12: GetFont = new System.Drawing.Font("Microsoft Sans Serif", 12, FontStyle.Regular); break; case SetFont.MSSANS14: GetFont = new System.Drawing.Font("Microsoft Sans Serif", 14, FontStyle.Regular); break; case SetFont.MSSANS10B: GetFont = new System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Bold); break; case SetFont.MSSANS11B: GetFont = new System.Drawing.Font("Microsoft Sans Serif", 11, FontStyle.Bold); break; case SetFont.MSSANS12B: GetFont = new System.Drawing.Font("Microsoft Sans Serif", 12, FontStyle.Bold); break; case SetFont.MSSANS14B: GetFont = new System.Drawing.Font("Microsoft Sans Serif", 14, FontStyle.Bold); break; default: GetFont = new System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Regular); break; } }
private void RefreshAppearance( ) { Widget widget = Widgets[0]; FormXObject normalAppearance; { AppearanceStates normalAppearances = widget.Appearance.Normal; normalAppearance = normalAppearances[null]; if (normalAppearance == null) { normalAppearances[null] = normalAppearance = new FormXObject(Document, widget.Box.Size); } } PdfName fontName = null; double fontSize = 0; { PdfString defaultAppearanceState = DefaultAppearanceState; if (defaultAppearanceState == null) { // Retrieving the font to define the default appearance... fonts::Font defaultFont = null; PdfName defaultFontName = null; { // Field fonts. FontResources normalAppearanceFonts = normalAppearance.Resources.Fonts; foreach (KeyValuePair <PdfName, fonts::Font> entry in normalAppearanceFonts) { if (!entry.Value.Symbolic) { defaultFont = entry.Value; defaultFontName = entry.Key; break; } } if (defaultFontName == null) { // Common fonts. FontResources formFonts = Document.Form.Resources.Fonts; foreach (KeyValuePair <PdfName, fonts::Font> entry in formFonts) { if (!entry.Value.Symbolic) { defaultFont = entry.Value; defaultFontName = entry.Key; break; } } if (defaultFontName == null) { //TODO:manage name collision! formFonts[ defaultFontName = new PdfName("default") ] = defaultFont = new fonts::StandardType1Font( Document, fonts::StandardType1Font.FamilyEnum.Helvetica, false, false ); } normalAppearanceFonts[defaultFontName] = defaultFont; } } bytes::Buffer buffer = new bytes::Buffer(); new SetFont(defaultFontName, IsMultiline ? 10 : 0).WriteTo(buffer, Document); widget.BaseDataObject[PdfName.DA] = defaultAppearanceState = new PdfString(buffer.ToByteArray()); } // Retrieving the font to use... ContentParser parser = new ContentParser(defaultAppearanceState.ToByteArray()); foreach (ContentObject content in parser.ParseContentObjects()) { if (content is SetFont) { SetFont setFontOperation = (SetFont)content; fontName = setFontOperation.Name; fontSize = setFontOperation.Size; break; } } normalAppearance.Resources.Fonts[fontName] = Document.Form.Resources.Fonts[fontName]; } // Refreshing the field appearance... /* * TODO: resources MUST be resolved both through the apperance stream resource dictionary and * from the DR-entry acroform resource dictionary */ PrimitiveComposer baseComposer = new PrimitiveComposer(normalAppearance); BlockComposer composer = new BlockComposer(baseComposer); ContentScanner currentLevel = composer.Scanner; bool textShown = false; while (currentLevel != null) { if (!currentLevel.MoveNext()) { currentLevel = currentLevel.ParentLevel; continue; } ContentObject content = currentLevel.Current; if (content is MarkedContent) { MarkedContent markedContent = (MarkedContent)content; if (PdfName.Tx.Equals(((BeginMarkedContent)markedContent.Header).Tag)) { // Remove old text representation! markedContent.Objects.Clear(); // Add new text representation! baseComposer.Scanner = currentLevel.ChildLevel; // Ensures the composer places new contents within the marked content block. ShowText(composer, fontName, fontSize); textShown = true; } } else if (content is Text) { currentLevel.Remove(); } else if (currentLevel.ChildLevel != null) { currentLevel = currentLevel.ChildLevel; } } if (!textShown) { baseComposer.BeginMarkedContent(PdfName.Tx); ShowText(composer, fontName, fontSize); baseComposer.End(); } baseComposer.Flush(); }
private void SetFontWithinHtmlTag(string tagName, SetFont setFont) { int start = doc.Content.Start; bool found = true; while (found) { found = false; int openingTagPos = OneTimeFindAndReplace(start, GetOpeningTag(tagName), ""); if (openingTagPos >= 0) { int closingTagPos = OneTimeFindAndReplace(openingTagPos, GetClosingTag(tagName), ""); if (closingTagPos >= 0) { MSWord.Range fontRange = doc.Range((object)openingTagPos, (object)closingTagPos); setFont(fontRange.Font); found = true; } } } }
public void AddGraphPort(IGraphPort aPort) { SetPixelHandler += new NewTOAPIA.Drawing.SetPixel(aPort.SetPixel); DrawLineHandler += new DrawLine(aPort.DrawLine); DrawLinesHandler += new DrawLines(aPort.DrawLines); DrawRectangleHandler += new NewTOAPIA.Drawing.DrawRectangle(aPort.DrawRectangle); DrawRectanglesHandler += new NewTOAPIA.Drawing.DrawRectangles(aPort.DrawRectangles); FillRectangleHandler += new NewTOAPIA.Drawing.FillRectangle(aPort.FillRectangle); DrawEllipseHandler += new NewTOAPIA.Drawing.DrawEllipse(aPort.DrawEllipse); FillEllipseHandler += new NewTOAPIA.Drawing.FillEllipse(aPort.FillEllipse); DrawRoundRectHandler += new NewTOAPIA.Drawing.DrawRoundRect(aPort.DrawRoundRect); PolygonHandler += new NewTOAPIA.Drawing.Polygon(aPort.Polygon); DrawBeziersHandler += new NewTOAPIA.Drawing.DrawBeziers(aPort.DrawBeziers); DrawPathHandler += new NewTOAPIA.Drawing.DrawPath(aPort.DrawPath); FillPathHandler += new FillPath(aPort.FillPath); //// Gradient fills //DrawGradientRectangleHandler += new NewTOAPIA.Drawing.DrawGradientRectangle(aPort.DrawGradientRectangle); //// Drawing Text DrawStringHandler += new NewTOAPIA.Drawing.DrawString(aPort.DrawString); ///// Draw bitmaps PixBltHandler += new NewTOAPIA.Drawing.PixBlt(aPort.PixBlt); //PixmapShardBltHandler += new NewTOAPIA.Drawing.PixmapShardBlt(aPort.PixmapShardBlt); //AlphaBlendHandler += new NewTOAPIA.Drawing.AlphaBlend(aPort.AlphaBlend); // Path handling //DrawPathHandler += new NewTOAPIA.Drawing.DrawPath(aPort.DrawPath); //SetPathAsClipRegionHandler += new NewTOAPIA.Drawing.SetPathAsClipRegion(aPort.SetPathAsClipRegion); //// Setting some objects SetPenHandler += new NewTOAPIA.Drawing.SetPen(aPort.SetPen); SetBrushHandler += new SetBrush(aPort.SetBrush); SetFontHandler += new SetFont(aPort.SetFont); //SelectStockObjectHandler += new NewTOAPIA.Drawing.SelectStockObject(aPort.SelectStockObject); SelectUniqueObjectHandler += new NewTOAPIA.Drawing.SelectUniqueObject(aPort.SelectUniqueObject); //// State Management FlushHandler += new NewTOAPIA.Drawing.Flush(aPort.Flush); SaveStateHandler += new NewTOAPIA.Drawing.SaveState(aPort.SaveState); ResetStateHandler += new NewTOAPIA.Drawing.ResetState(aPort.ResetState); RestoreStateHandler += new NewTOAPIA.Drawing.RestoreState(aPort.RestoreState); //// Setting Attributes and modes SetTextColorHandler += new NewTOAPIA.Drawing.SetTextColor(aPort.SetTextColor); //// Setting some modes SetBkColorHandler += new NewTOAPIA.Drawing.SetBkColor(aPort.SetBkColor); SetBkModeHandler += new NewTOAPIA.Drawing.SetBkMode(aPort.SetBkMode); SetMappingModeHandler += new NewTOAPIA.Drawing.SetMappingMode(aPort.SetMappingMode); SetPolyFillModeHandler += new NewTOAPIA.Drawing.SetPolyFillMode(aPort.SetPolyFillMode); SetROP2Handler += new NewTOAPIA.Drawing.SetROP2(aPort.SetROP2); SetClipRectangleHandler += new SetClipRectangle(aPort.SetClipRectangle); // World transform management SetWorldTransformHandler += new NewTOAPIA.Drawing.SetWorldTransform(aPort.SetWorldTransform); TranslateTransformHandler += new TranslateTransform(aPort.TranslateTransform); ScaleTransformHandler += new ScaleTransform(aPort.ScaleTransform); RotateTransformHandler += new RotateTransform(aPort.RotateTransform); }