Kayıtlar

Nisan 2, 2012 tarihine ait yayınlar gösteriliyor

ascentPixel , descentPixel

public double[] Ver(             string cFontAdi,             double nFontSize,             bool lKalin,             bool lItalik,             bool lAltiCizgili,             bool lUstuCizgili)         {             FontFamily fontAdi = new FontFamily(cFontAdi);             FontStyle Deneme = new FontStyle();             //Deneme = FontStyle.Regular;             if (lKalin) Deneme |= FontStyle.Bold;             if (lItalik) Deneme |= FontStyle.Italic;             if (lAltiCizgili) Deneme |= FontStyle.Underline;             if (lUstuCizgili) Deneme |= FontStyle.Strikeout;             double ascentPixel = (nFontSize * fontAdi.GetCellAscent(Deneme)) / fontAdi.GetEmHeight(Deneme);             double descentPixel = (nFontSize * fontAdi.GetCellDescent(Deneme)) / fontAdi.GetEmHeight(Deneme);             return new double[] { ascentPixel, descentPixel };         }
Resim
http://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html II. Glyph metrics 1. Baseline, pens and layouts The baseline is an imaginary line that is used to "guide" glyphs when rendering text. It can be horizontal (e.g. Roman, Cyrillic, Arabic, etc.) or vertical (e.g. Chinese, Japanese, Korean, etc). Moreover, to render text, a virtual point, located on the baseline, called the pen position or origin , is used to locate glyphs. Each layout uses a different convention for glyph placement: With horizontal layout, glyphs simply "rest" on the baseline. Text is rendered by incrementing the pen position, either to the right or to the left. The distance between two successive pen positions is glyph-specific and is called the advance width . Note that its value is always positive, even for right-to-left oriented alphabets, like Arabic. This introduces

String Format for Double [C#]

http://www.csharp-examples.net/examples/ The following examples show how to format float numbers to string in C#. You can use static method String.Format or instance methods double.ToString and float.ToString . Digits after decimal point This example formats double to string with fixed number of decimal places . For two decimal places use pattern „ 0.00 “. If a float number has less decimal places, the rest digits on the right will be zeroes. If it has more decimal places, the number will be rounded. [C#] // just two decimal places String .Format( "{0:0.00}" , 123.4567); // "123.46" String .Format( "{0:0.00}" , 123.4); // "123.40" String .Format( "{0:0.00}" , 123.0); // "123.00" Next example formats double to string with floating number of decimal places . E.g. for maximal two decimal places use pattern „ 0.## “. [C#] // max. two decimal places String .Format( "{0:0.##}" , 1