public virtual void TestNormalizingThinFontWeight() { NUnit.Framework.Assert.AreEqual(100, FontCharacteristicsUtils.NormalizeFontWeight((short)-10000)); NUnit.Framework.Assert.AreEqual(100, FontCharacteristicsUtils.NormalizeFontWeight((short)0)); NUnit.Framework.Assert.AreEqual(100, FontCharacteristicsUtils.NormalizeFontWeight((short)50)); NUnit.Framework.Assert.AreEqual(100, FontCharacteristicsUtils.NormalizeFontWeight((short)100)); }
public virtual void TestNormalizingNormalFontWeight() { NUnit.Framework.Assert.AreEqual(200, FontCharacteristicsUtils.NormalizeFontWeight((short)220)); NUnit.Framework.Assert.AreEqual(400, FontCharacteristicsUtils.NormalizeFontWeight((short)456)); NUnit.Framework.Assert.AreEqual(500, FontCharacteristicsUtils.NormalizeFontWeight((short)550)); NUnit.Framework.Assert.AreEqual(600, FontCharacteristicsUtils.NormalizeFontWeight((short)620)); NUnit.Framework.Assert.AreEqual(700, FontCharacteristicsUtils.NormalizeFontWeight((short)780)); }
/// <summary>Sets preferred font weight</summary> /// <param name="fw">font weight in css notation.</param> /// <seealso>com.itextpdf.io.font.constants.FontWeights.</seealso> /// <returns>this instance.</returns> public iText.Layout.Font.FontCharacteristics SetFontWeight(short fw) { if (fw > 0) { this.fontWeight = FontCharacteristicsUtils.NormalizeFontWeight(fw); Modified(); } return(this); }
public virtual void TestNormalizingHeavyFontWeight() { NUnit.Framework.Assert.AreEqual(900, FontCharacteristicsUtils.NormalizeFontWeight((short)900)); NUnit.Framework.Assert.AreEqual(900, FontCharacteristicsUtils.NormalizeFontWeight((short)1600)); NUnit.Framework.Assert.AreEqual(900, FontCharacteristicsUtils.NormalizeFontWeight((short)23000)); }