void ffmpegAttachmentSupport_AttachmentCompletedEvent(AttachmentSupport sender, UInt32 cbAttachment) { FontHelper.FireFontFamilyListChanged(cbAttachment); }
void SetFonts1(View BaseVieww) { FontHelper.SetFont_Bold(new int[] { Resource.Id.textView1, }, this.Activity, true, BaseVieww); }
protected override void Compile(AssetCompilerContext context, string urlInStorage, UFile assetAbsolutePath, SpriteFontAsset asset, AssetCompilerResult result) { var colorSpace = context.GetColorSpace(); if (asset.FontType is SignedDistanceFieldSpriteFontType) { var fontTypeSDF = asset.FontType as SignedDistanceFieldSpriteFontType; // copy the asset and transform the source and character set file path to absolute paths var assetClone = (SpriteFontAsset)AssetCloner.Clone(asset); var assetDirectory = assetAbsolutePath.GetParent(); assetClone.FontSource = asset.FontSource; fontTypeSDF.CharacterSet = !string.IsNullOrEmpty(fontTypeSDF.CharacterSet) ? UPath.Combine(assetDirectory, fontTypeSDF.CharacterSet) : null; result.BuildSteps = new AssetBuildStep(AssetItem) { new SignedDistanceFieldFontCommand(urlInStorage, assetClone) }; } else if (asset.FontType is RuntimeRasterizedSpriteFontType) { UFile fontPathOnDisk = asset.FontSource.GetFontPath(); if (fontPathOnDisk == null) { result.BuildSteps = new AssetBuildStep(AssetItem) { new FailedFontCommand() }; return; } var fontImportLocation = FontHelper.GetFontPath(asset.FontSource.GetFontName(), asset.FontSource.Style); result.BuildSteps = new AssetBuildStep(AssetItem) { new ImportStreamCommand { SourcePath = fontPathOnDisk, Location = fontImportLocation }, new RuntimeRasterizedFontCommand(urlInStorage, asset) }; } else { var fontTypeStatic = asset.FontType as OfflineRasterizedSpriteFontType; if (fontTypeStatic == null) { throw new ArgumentException("Tried to compile a non-offline rasterized sprite font with the compiler for offline resterized fonts!"); } // copy the asset and transform the source and character set file path to absolute paths var assetClone = (SpriteFontAsset)AssetCloner.Clone(asset); var assetDirectory = assetAbsolutePath.GetParent(); assetClone.FontSource = asset.FontSource; fontTypeStatic.CharacterSet = !string.IsNullOrEmpty(fontTypeStatic.CharacterSet) ? UPath.Combine(assetDirectory, fontTypeStatic.CharacterSet): null; result.BuildSteps = new AssetBuildStep(AssetItem) { new OfflineRasterizedFontCommand(urlInStorage, assetClone, colorSpace) }; } }
/// <summary> /// Create a GDI+ font and use its handle to retrieve font data using native calls. /// </summary> internal static XFontSource CreateFontSource(string familyName, FontResolvingOptions fontResolvingOptions, out GdiFont font, string typefaceKey) { if (string.IsNullOrEmpty(typefaceKey)) { typefaceKey = XGlyphTypeface.ComputeKey(familyName, fontResolvingOptions); } #if true_ if (familyName == "Cambria") { Debug - Break.Break(); } #endif GdiFontStyle gdiStyle = (GdiFontStyle)(fontResolvingOptions.FontStyle & XFontStyle.BoldItalic); // Create a 10 point GDI+ font as an exemplar. XFontSource fontSource; font = FontHelper.CreateFont(familyName, 10, gdiStyle, out fontSource); if (fontSource != null) { Debug.Assert(font != null); // Case: Font was created by a GDI+ private font collection. #if true #if DEBUG XFontSource existingFontSource; Debug.Assert(FontFactory.TryGetFontSourceByTypefaceKey(typefaceKey, out existingFontSource) && ReferenceEquals(fontSource, existingFontSource)); #endif #else // Win32 API cannot get font data from fonts created by private font collection, // because this is handled internally in GDI+. // Therefore the font source was created when the private font is added to the private font collection. if (!FontFactory.TryGetFontSourceByTypefaceKey(typefaceKey, out fontSource)) { // Simplify styles. // (The code is written for clarity - do not rearrange for optimization) if (font.Bold && font.Italic) { if (FontFactory.TryGetFontSourceByTypefaceKey(XGlyphTypeface.ComputeKey(font.Name, true, false), out fontSource)) { // Use bold font. FontFactory.CacheExistingFontSourceWithNewTypefaceKey(typefaceKey, fontSource); } else if (FontFactory.TryGetFontSourceByTypefaceKey(XGlyphTypeface.ComputeKey(font.Name, false, true), out fontSource)) { // Use italic font. FontFactory.CacheExistingFontSourceWithNewTypefaceKey(typefaceKey, fontSource); } else if (FontFactory.TryGetFontSourceByTypefaceKey(XGlyphTypeface.ComputeKey(font.Name, false, false), out fontSource)) { // Use regular font. FontFactory.CacheExistingFontSourceWithNewTypefaceKey(typefaceKey, fontSource); } } else if (font.Bold || font.Italic) { // Use regular font. if (FontFactory.TryGetFontSourceByTypefaceKey(XGlyphTypeface.ComputeKey(font.Name, false, false), out fontSource)) { FontFactory.CacheExistingFontSourceWithNewTypefaceKey(typefaceKey, fontSource); } } else { if (FontFactory.TryGetFontSourceByTypefaceKey(XGlyphTypeface.ComputeKey(font.Name, false, false), out fontSource)) { // Should never come here... FontFactory.CacheExistingFontSourceWithNewTypefaceKey(typefaceKey, fontSource); } } } #endif } else { // Get or create the font source and cache it unter the specified typeface key. fontSource = XFontSource.GetOrCreateFromGdi(typefaceKey, font); } return(fontSource); }
/// <summary> /// Internal implementation. /// </summary> internal static FontResolverInfo ResolveTypeface(string familyName, FontResolvingOptions fontResolvingOptions, string typefaceKey) { // Internally we often have the typeface key already. if (string.IsNullOrEmpty(typefaceKey)) { typefaceKey = XGlyphTypeface.ComputeKey(familyName, fontResolvingOptions); } // The user may call ResolveTypeface anytime from anywhere, so check cache in FontFactory in the first place. FontResolverInfo fontResolverInfo; if (FontFactory.TryGetFontResolverInfoByTypefaceKey(typefaceKey, out fontResolverInfo)) { return(fontResolverInfo); } // Let the platform create the requested font source and save both PlattformResolverInfo // and XFontSource in FontFactory cache. // It is possible that we already have the correct font source. E.g. we already have the regular typeface in cache // and looking now for the italic typeface, but no such font exists. In this case we get the regular font source // and cache again it with the italic typeface key. Furthermore in glyph typeface style simulation for italic is set. #if (CORE || GDI) && !WPF GdiFont gdiFont; XFontSource fontSource = CreateFontSource(familyName, fontResolvingOptions, out gdiFont, typefaceKey); #endif #if WPF && !SILVERLIGHT WpfFontFamily wpfFontFamily; WpfTypeface wpfTypeface; WpfGlyphTypeface wpfGlyphTypeface; XFontSource fontSource = CreateFontSource(familyName, fontResolvingOptions, out wpfFontFamily, out wpfTypeface, out wpfGlyphTypeface, typefaceKey); #endif #if SILVERLIGHT //GlyphTypeface wpfGlyphTypeface; XFontSource fontSource = null;//CreateFontSource(familyName, isBold, isItalic, out wpfGlyphTypeface, typefaceKey); #endif #if NETFX_CORE || UWP //GlyphTypeface wpfGlyphTypeface; XFontSource fontSource = null;//CreateFontSource(familyName, isBold, isItalic, out wpfGlyphTypeface, typefaceKey); #endif // If no such font exists return null. PDFsharp will fail. if (fontSource == null) { return(null); } //#if (CORE || GDI) && !WPF // // TODO: Support style simulation for GDI+ platform fonts. // fontResolverInfo = new PlatformFontResolverInfo(typefaceKey, false, false, gdiFont); //#endif if (fontResolvingOptions.OverrideStyleSimulations) { #if (CORE || GDI) && !WPF // TODO: Support style simulation for GDI+ platform fonts. fontResolverInfo = new PlatformFontResolverInfo(typefaceKey, fontResolvingOptions.MustSimulateBold, fontResolvingOptions.MustSimulateItalic, gdiFont); #endif #if WPF && !SILVERLIGHT fontResolverInfo = new PlatformFontResolverInfo(typefaceKey, fontResolvingOptions.MustSimulateBold, fontResolvingOptions.MustSimulateItalic, wpfFontFamily, wpfTypeface, wpfGlyphTypeface); #endif } else { #if (CORE || GDI) && !WPF bool mustSimulateBold = gdiFont.Bold && !fontSource.Fontface.os2.IsBold; bool mustSimulateItalic = gdiFont.Italic && !fontSource.Fontface.os2.IsItalic; fontResolverInfo = new PlatformFontResolverInfo(typefaceKey, mustSimulateBold, mustSimulateItalic, gdiFont); #endif #if WPF && !SILVERLIGHT // WPF knows what styles have to be simulated. bool mustSimulateBold = (wpfGlyphTypeface.StyleSimulations & WpfStyleSimulations.BoldSimulation) == WpfStyleSimulations.BoldSimulation; bool mustSimulateItalic = (wpfGlyphTypeface.StyleSimulations & WpfStyleSimulations.ItalicSimulation) == WpfStyleSimulations.ItalicSimulation; // Weird behavior of WPF is fixed here in case we request a bold italic typeface. // If only italic is available, bold is simulated based on italic. // If only bold is available, italic is simulated based on bold. // But if both bold and italic is available, italic face is used and bold is simulated. // The latter case is reversed here, i.e. bold face is used and italic is simulated. if (fontResolvingOptions.IsBoldItalic && mustSimulateBold && !mustSimulateItalic) { // Try to get the bold typeface. string typefaceKeyBold = XGlyphTypeface.ComputeKey(familyName, true, false); FontResolverInfo infoBold = ResolveTypeface(familyName, new FontResolvingOptions(FontHelper.CreateStyle(true, false)), typefaceKeyBold); // Use it if it does not base on simulateion. if (infoBold != null && infoBold.StyleSimulations == XStyleSimulations.None) { // Use existing bold typeface and simualte italic. fontResolverInfo = new PlatformFontResolverInfo(typefaceKeyBold, false, true, wpfFontFamily, wpfTypeface, wpfGlyphTypeface); } else { // Simulate both. fontResolverInfo = new PlatformFontResolverInfo(typefaceKey, true, true, wpfFontFamily, wpfTypeface, wpfGlyphTypeface); } } else { fontResolverInfo = new PlatformFontResolverInfo(typefaceKey, mustSimulateBold, mustSimulateItalic, wpfFontFamily, wpfTypeface, wpfGlyphTypeface); } #endif } #if SILVERLIGHT fontResolverInfo = null; //new PlattformResolverInfo(typefaceKey, false, false, wpfGlyphTypeface); #endif FontFactory.CacheFontResolverInfo(typefaceKey, fontResolverInfo); // Register font data under the platform specific face name. // Already done in CreateFontSource. // FontFactory.CacheNewFontSource(typefaceKey, fontSource); return(fontResolverInfo); }
private void UpdateFonts() { base.SuspendLayout(); this.tableLayoutPanel.SuspendLayout(); if (this.BaseFont != null) { this.labelDescription.Font = new Font(this.BaseFont.FontFamily, this.BaseFont.Size * FontHelper.GetScaleFactor(), this.BaseFont.Style); this.labelStatus.Font = new Font(this.labelDescription.Font.FontFamily, this.labelDescription.Font.Size); } else { this.labelDescription.Font = null; this.labelStatus.Font = null; } this.tableLayoutPanel.ResumeLayout(false); base.ResumeLayout(false); }
/// <summary> /// Initializes a new instance of the SettingsDialog class. /// </summary> public SettingsDialog() { this.InitializeComponent(); #region Apply custom font this.characterEditCheckBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.allowItemEditCheckBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.allowItemCopyCheckBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.skipTitleCheckBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.loadLastCharacterCheckBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.loadLastVaultCheckBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.vaultPathTextBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.vaultPathLabel.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.cancelButton.Font = FontHelper.GetFontAlbertusMTLight(12F); this.okayButton.Font = FontHelper.GetFontAlbertusMTLight(12F); this.resetButton.Font = FontHelper.GetFontAlbertusMTLight(12F); this.vaultPathBrowseButton.Font = FontHelper.GetFontAlbertusMTLight(12F); this.enableCustomMapsCheckBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.loadAllFilesCheckBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.suppressWarningsCheckBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.playerReadonlyCheckbox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.languageComboBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.languageLabel.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.detectLanguageCheckBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.titanQuestPathTextBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.titanQuestPathLabel.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.immortalThronePathLabel.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.immortalThronePathTextBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.detectGamePathsCheckBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.titanQuestPathBrowseButton.Font = FontHelper.GetFontAlbertusMTLight(12F); this.immortalThronePathBrowseButton.Font = FontHelper.GetFontAlbertusMTLight(12F); this.customMapLabel.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.mapListComboBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.baseFontLabel.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.baseFontComboBox.Font = FontHelper.GetFontAlbertusMTLight(11.25F); this.Font = FontHelper.GetFontAlbertusMTLight(11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)(0)); #endregion this.vaultPathLabel.Text = Resources.SettingsLabel1; this.languageLabel.Text = Resources.SettingsLabel2; this.titanQuestPathLabel.Text = Resources.SettingsLabel3; this.immortalThronePathLabel.Text = Resources.SettingsLabel4; this.customMapLabel.Text = Resources.SettingsLabel5; this.detectGamePathsCheckBox.Text = Resources.SettingsDetectGamePath; this.detectLanguageCheckBox.Text = Resources.SettingsDetectLanguage; this.enableCustomMapsCheckBox.Text = Resources.SettingsEnableMod; this.toolTip.SetToolTip(this.enableCustomMapsCheckBox, Resources.SettingsEnableModTT); this.skipTitleCheckBox.Text = Resources.SettingsSkipTitle; this.toolTip.SetToolTip(this.skipTitleCheckBox, Resources.SettingsSkipTitleTT); this.allowItemCopyCheckBox.Text = Resources.SettingsAllowCopy; this.toolTip.SetToolTip(this.allowItemCopyCheckBox, Resources.SettingsAllowCopyTT); this.allowItemEditCheckBox.Text = Resources.SettingsAllowEdit; this.toolTip.SetToolTip(this.allowItemEditCheckBox, Resources.SettingsAllowEdit); this.characterEditCheckBox.Text = Resources.SettingsAllowEditCE; this.toolTip.SetToolTip(this.characterEditCheckBox, Resources.SettingsAllowEditCE); this.loadLastCharacterCheckBox.Text = Resources.SettingsLoadChar; this.toolTip.SetToolTip(this.loadLastCharacterCheckBox, Resources.SettingsLoadCharTT); this.loadLastVaultCheckBox.Text = Resources.SettingsLoadVault; this.toolTip.SetToolTip(this.loadLastVaultCheckBox, Resources.SettingsLoadVaultTT); this.loadAllFilesCheckBox.Text = Resources.SettingsPreLoad; this.toolTip.SetToolTip(this.loadAllFilesCheckBox, Resources.SettingsPreLoadTT); this.suppressWarningsCheckBox.Text = Resources.SettingsNoWarning; this.toolTip.SetToolTip(this.suppressWarningsCheckBox, Resources.SettingsNoWarningTT); this.playerReadonlyCheckbox.Text = Resources.SettingsPlayerReadonly; this.toolTip.SetToolTip(this.playerReadonlyCheckbox, Resources.SettingsPlayerReadonlyTT); this.resetButton.Text = Resources.SettingsReset; this.toolTip.SetToolTip(this.resetButton, Resources.SettingsResetTT); this.cancelButton.Text = Resources.GlobalCancel; this.okayButton.Text = Resources.GlobalOK; this.Text = Resources.SettingsTitle; this.DrawCustomBorder = true; this.mapListComboBox.Items.Clear(); var maps = TQData.GetCustomMapList(); if (maps?.Any() ?? false) { this.mapListComboBox.Items.AddRange(maps); } if (!Config.Settings.Default.AllowCheats) { this.allowItemEditCheckBox.Visible = false; this.allowItemCopyCheckBox.Visible = false; this.characterEditCheckBox.Visible = false; } }
public static FontWeight GetFontWeight(string key) { return(FontHelper.GetFontWeight(GetInt(key))); }
public async Task <IHttpActionResult> SyncGetMilieage([FromUri] CLCS_MileageModel model) { //1.根据车牌号获取回单里程中相应车牌号创建时间最新的回单里程信息: //a.查无数据 //b.成功查询,返回里程数据 //2.上1查无数据,读取配置文件,查看相应的车牌号是否配置了回单里程: //a.查无数据 //b.成功查询,返回里程数据 //3.上1、2皆查无数据,通过车机信息正常计算里程数据: //a.车机信息有误,无法计算 //b.成功 #region 请求参数验证 if (model.EndTime <= model.StartTime) { return(AsiatekJson(ResponseCode.开始时间不能大于结束时间)); } TimeSpan ts = model.EndTime - model.StartTime; if (ts.Days > 7) { //里程查询天数超过7天 return(AsiatekJson(ResponseCode.查询天数不能超过7天)); } //将传过来的车牌号转换成简体 model.PlateNum = FontHelper.StringConvert(model.PlateNum, "2"); #endregion #region 查询里程数据 //返回数据有:vehicleCode、vehicleName、strucName、pStrucName、beginTime、endTime、returnMileage、beginMilieage、endMilieage //1、查询CLCS回单表中是否有数据 var result = await CLCS_MileageService.GetMilieageAsync(model).ConfigureAwait(false); if (result == null) { //2、查询配置文件 Dictionary <string, double> m_datas = new Dictionary <string, double>(); //暂时采用配置文件的方式存取 apikey var settingMilieageStr = WebConfigurationManager.AppSettings["SettingVehicleMilieages"]; if (!string.IsNullOrWhiteSpace(settingMilieageStr)) { try { var apiDatas = Newtonsoft.Json.JsonConvert.DeserializeObject <SettingVehicleMilieage>(settingMilieageStr); foreach (var item in apiDatas.Datas) { m_datas.Add(item.PlateNum.Trim(), item.Mileage); } } catch { return(AsiatekJson(ResponseCode.配置数据有误)); } if (m_datas.ContainsKey(model.PlateNum)) { double milieage; m_datas.TryGetValue(model.PlateNum, out milieage); model.ReturnMileage = milieage; var settingRs = await CLCS_MileageService.GetSettingMilieageAsync(model).ConfigureAwait(false); return(AsiatekJson(settingRs)); } else { //3、计算里程 var historyRs = await CLCS_MileageService.GetMilieageByHistoryAsync(model).ConfigureAwait(false); return(AsiatekJson(historyRs)); } } else { //3、计算里程 var historyRs = await CLCS_MileageService.GetMilieageByHistoryAsync(model).ConfigureAwait(false); return(AsiatekJson(historyRs)); } } else { return(AsiatekJson(result)); } #endregion }
protected override void Load() { Settings = SettingsRepository.GetAdvertisingSettings(); Fonts = new ObservableCollection <string>(FontHelper.GetInstalledFonts()); }
private void UpdateControls(View view) { FontHelper.UpdateFont(view.FindViewById <TextView>(Resource.Id.name_text), FontsConstants.PN_B, (float)0.05); FontHelper.UpdateFont(view.FindViewById <TextView>(Resource.Id.number_text), FontsConstants.PN_R, (float)0.025); }
public override void LoadContent() { base.LoadContent(); _spriteBatch = new SpriteBatch(GraphicsDevice); _background = Content.Load <Texture2D>("Images/MenuBackground"); //Load font range for scaling. _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-20")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-22")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-24")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-26")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-28")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-30")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-32")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-34")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-36")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-38")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-40")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-42")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-44")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-46")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-48")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-50")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-52")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-54")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-56")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-58")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-60")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-62")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-64")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-66")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-68")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-70")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-72")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-74")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-76")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-78")); fontPackage = FontHelper.GetFont(_fontList, proposedTextHeight, GraphicsDevice.Viewport.Bounds); newGame = FontHelper.SetTextBoxPosition(newGame, fontPackage, GraphicsDevice.Viewport.Bounds, VerticalPosition.Centered, 0f, HorizontalPosition.Centered, 0f); RectangleF newGameRectangle = fontPackage.Font.GetStringRectangle(newGame.Value); float centerPointNewGame = GraphicsDevice.Viewport.Bounds.Width / 2f - (newGameRectangle.Width / 2f); float verticalPointNewGame = GraphicsDevice.Viewport.Bounds.Height * 0.25f; newGame.Location = new Vector2(centerPointNewGame, verticalPointNewGame); newGameRectangle.Position = new Point2(newGame.Location.X, newGame.Location.Y); newGame.BoundingBox = newGameRectangle; RectangleF loadGameRectangle = fontPackage.Font.GetStringRectangle(loadGame.Value); float centerPointLoadGame = GraphicsDevice.Viewport.Bounds.Width / 2f - (loadGameRectangle.Width / 2f); float verticalPointLoadGame = verticalPointNewGame + (newGame.BoundingBox.Height * 1.5f); loadGame.Location = new Vector2(centerPointLoadGame, verticalPointLoadGame); RectangleF optionsRectangle = fontPackage.Font.GetStringRectangle(options.Value); float centerPointOptions = GraphicsDevice.Viewport.Bounds.Width / 2f - (optionsRectangle.Width / 2f); float verticalPointOptions = verticalPointLoadGame + (newGame.BoundingBox.Height * 1.5f); options.Location = new Vector2(centerPointOptions, verticalPointOptions); RectangleF exitRectangle = fontPackage.Font.GetStringRectangle(exit.Value); float centerPointExit = GraphicsDevice.Viewport.Bounds.Width / 2f - (exitRectangle.Width / 2f); float verticalPointExit = verticalPointOptions + (newGame.BoundingBox.Height * 1.5f); exit.Location = new Vector2(centerPointExit, verticalPointExit); exitRectangle.Position = new Point2(exit.Location.X, exit.Location.Y); exit.BoundingBox = exitRectangle; }
//public void ChooseText() //{ // switch (_randGen.Next(0, 36)) // { // case 0: // _randomText = "Hello there."; // break; // case 1: // _randomText = "Walnuts are yummy."; // break; // case 2: // _randomText = "Stephen smells like roses."; // break; // case 3: // _randomText = "Salmon is a good source of protein."; // break; // case 4: // _randomText = "Indeeeeeeeeeed."; // break; // case 5: // _randomText = "Loading the loading screen."; // break; // case 6: // _randomText = "Reticulating spines."; // break; // case 7: // _randomText = "Error 404: Level not found."; // break; // case 8: // _randomText = "You are beautiful."; // break; // case 9: // _randomText = "Trying to find lost keys."; // break; // case 10: // _randomText = "Deleting system memory."; // break; // case 11: // _randomText = "Windows update incoming."; // break; // case 12: // _randomText = "You have lost connection to the internet."; // break; // case 13: // _randomText = "Lighting the darkness."; // break; // case 14: // _randomText = "Moving immovable objects."; // break; // case 15: // _randomText = "Stopping unstoppable force."; // break; // case 16: // _randomText = "Nerfing Irelia."; // break; // case 17: // _randomText = "Meow."; // break; // case 18: // _randomText = "Upgrading antiviruses."; // break; // case 19: // _randomText = "Opening Internet Explorer."; // break; // case 20: // _randomText = "Putting out the firewall."; // break; // case 21: // _randomText = "Giving Satan a massage."; // break; // case 22: // _randomText = "Doing Satan's pedicure."; // break; // case 23: // _randomText = "Far Lands or Bust!"; // break; // case 24: // _randomText = "Shaving bears."; // break; // case 25: // _randomText = "Drinking tea."; // break; // case 26: // _randomText = "Starting pillow fight."; // break; // case 27: // _randomText = "Reloading the unloadable."; // break; // case 28: // _randomText = "Checking out pictures folder."; // break; // case 29: // _randomText = "Taking a break."; // break; // case 30: // _randomText = "Loading assets."; // break; // case 31: // _randomText = "Googling for solution."; // break; // case 32: // _randomText = "Oh oh, we might blue screen!"; // break; // case 33: // _randomText = "Deleting user files."; // break; // case 34: // _randomText = "Drinking water."; // break; // case 35: // _randomText = "Pretending to load."; // break; // } // _textChosen = true; //} public static void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(_background, new Rectangle(0, 0, TMBAW_Game.UserResWidth, TMBAW_Game.UserResHeight), Color.White); FontHelper.DrawWithOutline(spriteBatch, _fontBig, _loadingDots, new Vector2(50, TMBAW_Game.UserResHeight - 100), 3, Color.White, Color.DarkGray); FontHelper.DrawWithOutline(spriteBatch, _fontSmall, LoadingText, new Vector2(50, TMBAW_Game.UserResHeight - 50), 3, Color.White, Color.DarkGray); }
public void Load(string value, string valueName) { float floatResult; bool boolResult; switch (valueName) { case "IsLoggingEnabled": this.IsLoggingEnabled = !bool.TryParse(value, out boolResult) || boolResult; break; case "IsNLogConfigLoggingEnabled": this.IsNLogConfigLoggingEnabled = bool.TryParse(value, out boolResult) && boolResult; break; case "IsTraceEnabled": this.IsTraceEnabled = bool.TryParse(value, out boolResult) && boolResult; break; case "IsDebugEnabled": this.IsDebugEnabled = bool.TryParse(value, out boolResult) && boolResult; break; case "IsInfoEnabled": this.IsInfoEnabled = !bool.TryParse(value, out boolResult) || boolResult; break; case "IsWarnEnabled": this.IsWarnEnabled = !bool.TryParse(value, out boolResult) || boolResult; break; case "IsFatalEnabled": this.IsFatalEnabled = !bool.TryParse(value, out boolResult) || boolResult; break; case "IsErrorEnabled": this.IsErrorEnabled = !bool.TryParse(value, out boolResult) || boolResult; break; case "FontFamily": this.FontFamily = value ?? "Verdana"; break; case "GiganticFactor": this.GiganticFactor = float.TryParse(value, out floatResult) ? floatResult : 2f; break; case "HugeFactor": this.HugeFactor = float.TryParse(value, out floatResult) ? floatResult : 1.6667f; break; case "LargeFactor": this.LargeFactor = float.TryParse(value, out floatResult) ? floatResult : 1.3333f; break; case "SmallFactor": this.SmallFactor = float.TryParse(value, out floatResult) ? floatResult : .85f; break; case "TinyFactor": this.TinyFactor = float.TryParse(value, out floatResult) ? floatResult : .70f; break; case "MicroFactor": this.MicroFactor = float.TryParse(value, out floatResult) ? floatResult : .55f; break; case "Task01": this.Task01 = value ?? "Todo"; break; case "Task02": this.Task02 = value ?? "Hack"; break; case "Task03": this.Task03 = value ?? "Question"; break; case "Task04": this.Task04 = value ?? "Bug"; break; case "Task05": this.Task05 = value ?? "Note"; break; case "Task06": this.Task06 = value ?? ""; break; case "Task07": this.Task07 = value ?? ""; break; case "Task08": this.Task08 = value ?? ""; break; case "Task09": this.Task09 = value ?? ""; break; case "Task10": this.Task10 = value ?? ""; break; case "TaskBold01": this.TaskBold01 = !bool.TryParse(value, out boolResult) || boolResult; break; case "TaskBold02": this.TaskBold02 = !bool.TryParse(value, out boolResult) || boolResult; break; case "TaskBold03": this.TaskBold03 = !bool.TryParse(value, out boolResult) || boolResult; break; case "TaskBold04": this.TaskBold04 = !bool.TryParse(value, out boolResult) || boolResult; break; case "TaskBold05": this.TaskBold05 = !bool.TryParse(value, out boolResult) || boolResult; break; case "TaskBold06": this.TaskBold06 = !bool.TryParse(value, out boolResult) || boolResult; break; case "TaskBold07": this.TaskBold07 = !bool.TryParse(value, out boolResult) || boolResult; break; case "TaskBold08": this.TaskBold08 = !bool.TryParse(value, out boolResult) || boolResult; break; case "TaskBold09": this.TaskBold09 = !bool.TryParse(value, out boolResult) || boolResult; break; case "TaskBold10": this.TaskBold10 = !bool.TryParse(value, out boolResult) || boolResult; break; case "TaskColor01": this.TaskColor01 = value ?? "0000ff"; break; case "TaskColor02": this.TaskColor02 = value ?? "008000"; break; case "TaskColor03": this.TaskColor03 = value ?? "ff00d6"; break; case "TaskColor04": this.TaskColor04 = value ?? "ff0000"; break; case "TaskColor05": this.TaskColor05 = value ?? "8b0807"; break; case "TaskColor06": this.TaskColor06 = value ?? "000000"; break; case "TaskColor07": this.TaskColor07 = value ?? "000000"; break; case "TaskColor08": this.TaskColor08 = value ?? "000000"; break; case "TaskColor09": this.TaskColor09 = value ?? "000000"; break; case "TaskColor10": this.TaskColor10 = value ?? "000000"; break; case "TaskTypeface01": this.TaskTypeface01 = FontHelper.GetTypeFace(value ?? "Verdana"); break; case "TaskTypeface02": this.TaskTypeface02 = FontHelper.GetTypeFace(value ?? "Verdana"); break; case "TaskTypeface03": this.TaskTypeface03 = FontHelper.GetTypeFace(value ?? "Verdana"); break; case "TaskTypeface04": this.TaskTypeface04 = FontHelper.GetTypeFace(value ?? "Verdana"); break; case "TaskTypeface05": this.TaskTypeface05 = FontHelper.GetTypeFace(value ?? "Verdana"); break; case "TaskTypeface06": this.TaskTypeface06 = FontHelper.GetTypeFace(value ?? "Verdana"); break; case "TaskTypeface07": this.TaskTypeface07 = FontHelper.GetTypeFace(value ?? "Verdana"); break; case "TaskTypeface08": this.TaskTypeface08 = FontHelper.GetTypeFace(value ?? "Verdana"); break; case "TaskTypeface09": this.TaskTypeface09 = FontHelper.GetTypeFace(value ?? "Verdana"); break; case "TaskTypeface10": this.TaskTypeface10 = FontHelper.GetTypeFace(value ?? "Verdana"); break; } }
private void UpdateControls(View view) { FontHelper.UpdateFont(view.FindViewById <TextView>(Resource.Id.tv_count), FontsConstants.PN_R, (float)0.04); FontHelper.UpdateFont(view.FindViewById <TextView>(Resource.Id.user_name), FontsConstants.PN_R, (float)0.04); }
/// ------------------------------------------------------------------------------------ protected override void OnLoad(EventArgs e) { SetLabelFonts(this, FontHelper.MakeFont(Program.DialogFont, FontStyle.Bold)); base.OnLoad(e); }
/// <summary> /// Creates a textbox in the specified location that takes in input when selected. /// </summary> /// <param name="x">The x coordinate.</param> /// <param name="y">The y coordinate.</param> /// <param name="width">THe width of the textbox.</param> public Textbox(int x, int y, int width, int height) { _white = ContentHelper.LoadTexture("Tiles/white"); _font = FontHelper.ChooseBestFont(height); DrawRectangle = new Rectangle(x, y, width, height); }
private void UpdateControls(View view) { FontHelper.UpdateFont(view.FindViewById <TextView>(Resource.Id.tv_date), FontsConstants.PN_R, (float)0.037); FontHelper.UpdateFont(view.FindViewById <TextView>(Resource.Id.points_text), FontsConstants.PN_B, (float)0.04); FontHelper.UpdateFont(view.FindViewById <TextView>(Resource.Id.transaction_text), FontsConstants.PN_R, (float)0.03); }
private void DrawText() { GraphicsDevice.Clear(GraphicsDevice.BackBuffer, Color.Black); GraphicsDevice.Clear(GraphicsDevice.DepthStencilBuffer, DepthStencilClearOptions.DepthBuffer); // Render the text spriteBatch.Begin(); var x = 20; var y = 10; var size = 8; msMincho10.PreGenerateGlyphs(BuildTextSize(size), FontHelper.PointsToPixels(size) * Vector2.One); var dim = msMincho10.MeasureString(BuildTextSize(size), FontHelper.PointsToPixels(size)); spriteBatch.DrawString(msMincho10, BuildTextSize(size), FontHelper.PointsToPixels(size), new Vector2(x, y), Color.White); size = 10; y += (int)Math.Ceiling(dim.Y); msMincho10.PreGenerateGlyphs(BuildTextSize(size), FontHelper.PointsToPixels(size) * Vector2.One); dim = msMincho10.MeasureString(BuildTextSize(size), FontHelper.PointsToPixels(size)); spriteBatch.DrawString(msMincho10, BuildTextSize(size), FontHelper.PointsToPixels(size), new Vector2(x, y), Color.White); size = 12; y += (int)Math.Ceiling(dim.Y); msMincho10.PreGenerateGlyphs(BuildTextSize(size), FontHelper.PointsToPixels(size) * Vector2.One); dim = msMincho10.MeasureString(BuildTextSize(size), FontHelper.PointsToPixels(size)); spriteBatch.DrawString(msMincho10, BuildTextSize(size), FontHelper.PointsToPixels(size), new Vector2(x, y), Color.White); size = 14; y += (int)Math.Ceiling(dim.Y); msMincho10.PreGenerateGlyphs(BuildTextSize(size), FontHelper.PointsToPixels(size) * Vector2.One); dim = msMincho10.MeasureString(BuildTextSize(size), FontHelper.PointsToPixels(size)); spriteBatch.DrawString(msMincho10, BuildTextSize(size), FontHelper.PointsToPixels(size), new Vector2(x, y), Color.White); size = 16; y += (int)Math.Ceiling(dim.Y); msMincho10.PreGenerateGlyphs(BuildTextSize(size), FontHelper.PointsToPixels(size) * Vector2.One); dim = msMincho10.MeasureString(BuildTextSize(size), FontHelper.PointsToPixels(size)); spriteBatch.DrawString(msMincho10, BuildTextSize(size), FontHelper.PointsToPixels(size), new Vector2(x, y), Color.White); size = 20; y += (int)Math.Ceiling(dim.Y); msMincho10.PreGenerateGlyphs(BuildTextSize(size), FontHelper.PointsToPixels(size) * Vector2.One); dim = msMincho10.MeasureString(BuildTextSize(size), FontHelper.PointsToPixels(size)); spriteBatch.DrawString(msMincho10, BuildTextSize(size), FontHelper.PointsToPixels(size), new Vector2(x, y), Color.White); size = 25; y += (int)Math.Ceiling(dim.Y); msMincho10.PreGenerateGlyphs(BuildTextSize(size), FontHelper.PointsToPixels(size) * Vector2.One); dim = msMincho10.MeasureString(BuildTextSize(size), FontHelper.PointsToPixels(size)); spriteBatch.DrawString(msMincho10, BuildTextSize(size), FontHelper.PointsToPixels(size), new Vector2(x, y), Color.White); // change the varying string if necessary if (accumulatedSeconds > VaryingStringTimeInterval) { accumulatedSeconds = 0; for (int i = 0; i < VaryingStringLength;) { for (int j = 0; j < 50 && i < VaryingStringLength; j++, ++i) { varyingString[i] = (char)varyingStringCurrentIndex; ++varyingStringCurrentIndex; if (varyingStringCurrentIndex > VaryingStringEndIndex) { varyingStringCurrentIndex = VaryingStringStartIndex; } } // add return lines if (i < VaryingStringLength) { varyingString[i] = '\n'; ++i; } } } // print varying text y += (int)Math.Ceiling(dim.Y) + 10; msMincho10.PreGenerateGlyphs(varyingString.ToString(), 16 * Vector2.One); spriteBatch.DrawString(msMincho10, varyingString, 16, new Vector2(x, y), Color.White); spriteBatch.End(); }
/// ------------------------------------------------------------------------------------ /// <param name="model">View model</param> /// <param name="localizationManagerId">The ID of the localization manager for the /// calling application.</param> /// <param name="programDialogFont">Application can set this to ensure a consistent look /// in the UI (especially useful for when a localization requires a particular font).</param> /// <param name="settings">Location, size, and state where the client would like the /// dialog box to appear (can be null)</param> /// ------------------------------------------------------------------------------------ public ArchivingDlg(ArchivingDlgViewModel model, string localizationManagerId, Font programDialogFont, FormSettings settings) { _settings = settings ?? FormSettings.Create(this); _viewModel = model; InitializeComponent(); if (!string.IsNullOrEmpty(localizationManagerId)) { locExtender.LocalizationManagerId = localizationManagerId; } Text = string.Format(Text, model.AppName, model.ArchiveType); _progressBar.Visible = false; // remember this because we will need it later in a derived class _launchButtonTextFormat = _buttonLaunchRamp.Text; UpdateLaunchButtonText(); _buttonLaunchRamp.Enabled = false; //!string.IsNullOrEmpty(model.PathToProgramToLaunch); _chkMetadataOnly.Visible = _viewModel is ISupportMetadataOnly; _linkOverview.Text = model.InformativeText; _linkOverview.Links.Clear(); if (!string.IsNullOrEmpty(model.ArchiveInfoUrl) && !string.IsNullOrEmpty(model.ArchiveInfoHyperlinkText)) { int i = _linkOverview.Text.IndexOf(model.ArchiveInfoHyperlinkText, StringComparison.InvariantCulture); if (i >= 0) { _linkOverview.Links.Add(i, model.ArchiveInfoHyperlinkText.Length, model.ArchiveInfoUrl); } } // this is for a display problem in mono _linkOverview.SizeToContents(); _logBox.Tag = false; model.OnDisplayMessage += DisplayMessage; model.OnDisplayError += new ArchivingDlgViewModel.DisplayErrorEventHandler(model_DisplayError); if (programDialogFont != null) { _linkOverview.Font = programDialogFont; _logBox.Font = FontHelper.MakeFont(programDialogFont, FontStyle.Bold); _buttonCancel.Font = programDialogFont; _buttonCreatePackage.Font = programDialogFont; _buttonLaunchRamp.Font = programDialogFont; Font = programDialogFont; } _buttonLaunchRamp.Click += (s, e) => model.LaunchArchivingProgram(); _buttonCancel.MouseLeave += delegate { if (model.IsBusy) { WaitCursor.Show(); } }; _buttonCancel.MouseEnter += delegate { if (model.IsBusy) { WaitCursor.Hide(); } }; _buttonCancel.Click += delegate { model.Cancel(); WaitCursor.Hide(); }; }
private void UpdateControls() { FontHelper.UpdateFont(view.FindViewById <TextView>(Resource.Id.ph_title), FontsConstants.PN_B, (float)0.09); FontHelper.UpdateFont(view.FindViewById <TextView>(Resource.Id.ph_text), FontsConstants.PN_R, (float)0.04); }
private bool ShouldSerializeFont() { return(this.Font == FontHelper.GetDefaultFont()); }
/// <summary> /// Resolves the typeface by generating a font resolver info. /// </summary> /// <param name="familyName">Name of the font family.</param> /// <param name="isBold">Indicates whether a bold font is requested.</param> /// <param name="isItalic">Indicates whether an italic font is requested.</param> public static FontResolverInfo ResolveTypeface(string familyName, bool isBold, bool isItalic) { FontResolvingOptions fontResolvingOptions = new FontResolvingOptions(FontHelper.CreateStyle(isBold, isItalic)); return(ResolveTypeface(familyName, fontResolvingOptions, XGlyphTypeface.ComputeKey(familyName, fontResolvingOptions))); }
private void UpdateFontSetting() { base.SuspendLayout(); this.Font = FontHelper.GetDefaultFont(); base.ResumeLayout(false); }
private void Loaded(object sender, RoutedEventArgs e) { FontSource.Clear(); FontHelper.LoadFonts(FontSource, FontTypes.App, DeleteFontTapped, null); }
/// ------------------------------------------------------------------------------------ public void Save() { var project = new XElement("Project"); project.Add(new XElement("Iso639Code", Iso639Code.NullTrim())); project.Add(!TranscriptionFont.Equals(Program.DialogFont) ? new XElement("transcriptionFont", FontHelper.FontToString(TranscriptionFont)) : new XElement("transcriptionFont", null)); project.Add(!FreeTranslationFont.Equals(Program.DialogFont) ? new XElement("freeTranslationFont", FontHelper.FontToString(FreeTranslationFont)) : new XElement("freeTranslationFont", null)); var autoSegmenterSettings = new XElement("AutoSegmentersettings"); project.Add(autoSegmenterSettings); if (AutoSegmenterMinimumSegmentLengthInMilliseconds != Settings.Default.DefaultAutoSegmenterMinimumSegmentLengthInMilliseconds || AutoSegmenterMaximumSegmentLengthInMilliseconds != Settings.Default.DefaultAutoSegmenterMaximumSegmentLengthInMilliseconds || AutoSegmenterPreferrerdPauseLengthInMilliseconds != Settings.Default.DefaultAutoSegmenterPreferrerdPauseLengthInMilliseconds || !AutoSegmenterOptimumLengthClampingFactor.Equals(Settings.Default.DefaultAutoSegmenterOptimumLengthClampingFactor)) { autoSegmenterSettings.Add(new XAttribute("minSegmentLength", AutoSegmenterMinimumSegmentLengthInMilliseconds)); autoSegmenterSettings.Add(new XAttribute("maxSegmentLength", AutoSegmenterMaximumSegmentLengthInMilliseconds)); autoSegmenterSettings.Add(new XAttribute("preferrerdPauseLength", AutoSegmenterPreferrerdPauseLengthInMilliseconds)); autoSegmenterSettings.Add(new XAttribute("optimumLengthClampingFactor", AutoSegmenterOptimumLengthClampingFactor)); } else { autoSegmenterSettings.Add(new XAttribute("minSegmentLength", "0")); autoSegmenterSettings.Add(new XAttribute("maxSegmentLength", "0")); autoSegmenterSettings.Add(new XAttribute("preferrerdPauseLength", "0")); autoSegmenterSettings.Add(new XAttribute("optimumLengthClampingFactor", "0")); } // metadata for archiving project.Add(new XElement("Title", Title.NullTrim())); project.Add(new XElement("FundingProjectTitle", FundingProjectTitle.NullTrim())); project.Add(new XElement("ProjectDescription", ProjectDescription.NullTrim())); project.Add(new XElement("VernacularISO3CodeAndName", VernacularISO3CodeAndName.NullTrim())); project.Add(new XElement("AnalysisISO3CodeAndName", AnalysisISO3CodeAndName.NullTrim())); project.Add(new XElement("Location", Location.NullTrim())); project.Add(new XElement("Region", Region.NullTrim())); project.Add(new XElement("Country", Country.NullTrim() ?? "Unspecified")); project.Add(new XElement("Continent", Continent.NullTrim() ?? "Unspecified")); project.Add(new XElement("ContactPerson", ContactPerson.NullTrim())); project.Add(new XElement("AccessProtocol", AccessProtocol.NullTrim())); project.Add(new XElement("DateAvailable", DateAvailable.NullTrim())); project.Add(new XElement("RightsHolder", RightsHolder.NullTrim())); project.Add(new XElement("Depositor", Depositor.NullTrim())); project.Add(new XElement("IMDIOutputDirectory", IMDIOutputDirectory.NullTrim())); int retryCount = 1; Exception error; do { try { error = null; project.Save(SettingsFilePath); break; } catch (Exception e) { error = e; if (retryCount-- == 0) { break; } Thread.Sleep(250); } } while (true); if (error != null) { ErrorReport.NotifyUserOfProblem(error, LocalizationManager.GetString("MainWindow.ProblemSavingSayMoreProject", "There was a problem saving the SayMore project:\r\n\r\n{0}"), SettingsFilePath); } if (_accessProtocolChanged) { foreach (var editor in Program.GetControlsOfType <SessionBasicEditor>(Program.ProjectWindow)) { editor.SetAccessProtocol(); } _accessProtocolChanged = false; } }
void SetFontsRadioButtons(View BaseVieww) { FontHelper.SetFont_Bold(new int[] { Resource.Id.radioButton2, }, this.Activity, true, BaseVieww); }
/// ------------------------------------------------------------------------------------ public void Load() { // SP-791: Invalid URI: The hostname could not be parsed. Uri settingsUri; if (!Uri.TryCreate(SettingsFilePath, UriKind.Absolute, out settingsUri)) { var msg = LocalizationManager.GetString("DialogBoxes.LoadProject.InvalidPath", "SayMore is not able to open the project file. \"{0}\" is not a valid path."); ErrorReport.ReportNonFatalMessageWithStackTrace(msg, SettingsFilePath); // allow the user to select a different project var prs = new Process(); prs.StartInfo.FileName = Application.ExecutablePath; prs.StartInfo.Arguments = "-nl"; prs.Start(); Environment.Exit(0); } var project = XElement.Load(SettingsFilePath); var settingValue = GetStringSettingValue(project, "Iso639Code", null); if (string.IsNullOrEmpty(settingValue)) { settingValue = GetStringSettingValue(project, "IsoCode", null); //old value when we were called "Sponge" } if (!string.IsNullOrEmpty(settingValue)) { Iso639Code = settingValue; } settingValue = GetStringSettingValue(project, "transcriptionFont", null); if (!string.IsNullOrEmpty(settingValue)) { TranscriptionFont = FontHelper.MakeFont(settingValue); _needToDisposeTranscriptionFont = true; } settingValue = GetStringSettingValue(project, "freeTranslationFont", null); if (!string.IsNullOrEmpty(settingValue)) { FreeTranslationFont = FontHelper.MakeFont(settingValue); _needToDisposeFreeTranslationFont = true; } var autoSegmenterSettings = project.Element("AutoSegmentersettings"); if (autoSegmenterSettings != null) { AutoSegmenterMinimumSegmentLengthInMilliseconds = GetIntAttributeValue(autoSegmenterSettings, "minSegmentLength"); AutoSegmenterMaximumSegmentLengthInMilliseconds = GetIntAttributeValue(autoSegmenterSettings, "maxSegmentLength"); AutoSegmenterPreferrerdPauseLengthInMilliseconds = GetIntAttributeValue(autoSegmenterSettings, "preferrerdPauseLength"); AutoSegmenterOptimumLengthClampingFactor = GetDoubleAttributeValue(autoSegmenterSettings, "optimumLengthClampingFactor"); } Title = GetStringSettingValue(project, "Title", string.Empty); FundingProjectTitle = GetStringSettingValue(project, "FundingProjectTitle", string.Empty); ProjectDescription = GetStringSettingValue(project, "ProjectDescription", string.Empty); VernacularISO3CodeAndName = GetStringSettingValue(project, "VernacularISO3CodeAndName", string.Empty); AnalysisISO3CodeAndName = GetStringSettingValue(project, "AnalysisISO3CodeAndName", ArchivingHelper.AnalysisLanguage()); Location = GetStringSettingValue(project, "Location", string.Empty); Region = GetStringSettingValue(project, "Region", string.Empty); Country = GetStringSettingValue(project, "Country", "Unspecified"); Continent = GetStringSettingValue(project, "Continent", "Unspecified"); ContactPerson = GetStringSettingValue(project, "ContactPerson", string.Empty); AccessProtocol = GetStringSettingValue(project, "AccessProtocol", string.Empty); _accessProtocolChanged = false; DateAvailable = GetStringSettingValue(project, "DateAvailable", string.Empty); RightsHolder = GetStringSettingValue(project, "RightsHolder", string.Empty); Depositor = GetStringSettingValue(project, "Depositor", string.Empty); IMDIOutputDirectory = GetStringSettingValue(project, "IMDIOutputDirectory", string.Empty); }
static void Main(string[] args) { // Initialize display (busId = 1 for Raspberry Pi 2 & 3) using var display = new Large4Digit7SegmentDisplay(I2cDevice.Create(new I2cConnectionSettings(busId: 1, Ht16k33.DefaultI2cAddress))) { // Set max brightness Brightness = Ht16k33.MaxBrightness }; // Write "Iot" on the display display.Write("Iot"); // Wait 2 seconds Thread.Sleep(2000); // Change 'o' to '°' in "IoT" display[1] = (Segment)FontHelper.GetCharacter('°'); // Wait .5 seconds Thread.Sleep(500); // Write 42 to the left side of the display display.Write(42, Alignment.Left); // Set blinkrate to once per second display.BlinkRate = BlinkRate.Blink1Hz; // Wait 5 seconds Thread.Sleep(5000); // Set blinkrate to twice per second display.BlinkRate = BlinkRate.Blink2Hz; // Write 42 to the right side of the display display.Write(42, Alignment.Right); // Set brightness to half max display.Brightness = Ht16k33.MaxBrightness / 2; // Wait 2 seconds Thread.Sleep(2000); // Turn off blinking display.BlinkRate = BlinkRate.Off; // Write time to the display display.Write(DateTime.Now.ToString("H:mm").PadLeft(5)); // Wait 3 seconds Thread.Sleep(3000); // Turn on buffering display.BufferingEnabled = true; // Write -42°C to display using "decimal point" between 3rd and 4th digit as the ° character display.Write("-42C"); display.Dots = Dot.DecimalPoint; // Turn off buffering display.BufferingEnabled = false; // Wait 3 seconds Thread.Sleep(3000); var stringSamples = new[]
public XSize MeasureString(XGraphics gfx, string text, XFont font, XStringFormat stringFormat) { TextBlock textBlock = FontHelper.CreateTextBlock(text, null, font.Size, null); return(new XSize(textBlock.ActualWidth, textBlock.ActualHeight)); }