private void OnFontChanged(object sender, EventArgs e) { if (_alreadyChanging) { return; } Control control = (Control)sender; _alreadyChanging = true; _originalControlProperties[control].Font = control.Font; var hints = control as ILocalizableControl; if (hints == null || hints.ShouldModifyFont) { if (control is LinkLabel && ((LinkLabel)control).UseMnemonic == false) { //then that link is for user data, and shouldn't be localized (this came up in Chorus AnnotationEditorView) } else { var font = StringCatalog.ModifyFontForLocalization(control.Font); control.Font = font; } } _alreadyChanging = false; }
public void ModifyFontForLocation_HugeFont_ValidFont() { StringCatalog catalog = new StringCatalog(_poFile, FontFamily.GenericSerif.Name, Single.MaxValue); Font normal = new Font(FontFamily.GenericSerif, Single.MaxValue); Font localized = StringCatalog.ModifyFontForLocalization(normal); Assert.IsNotNull(localized); }
public void FontsDoNotChange() { StringCatalog catalog = new StringCatalog(_poFile, FontFamily.GenericSansSerif.Name, 30); Font normal = new Font(FontFamily.GenericSerif, 20); Font localized = StringCatalog.ModifyFontForLocalization(normal); Assert.AreEqual(FontFamily.GenericSerif.Name, localized.FontFamily.Name); }
public void FontsDoNotScaleUp() { StringCatalog catalog = new StringCatalog(_poFile, "Onyx", 30); Font normal = new Font(System.Drawing.FontFamily.GenericSerif, 20); Font localized = StringCatalog.ModifyFontForLocalization(normal); Assert.AreEqual(20, Math.Floor(localized.SizeInPoints)); }