Gnostice XtremeFontEngine 1.0.0.102 » Developer.Team

Gnostice XtremeFontEngine 1.0.0.102

Gnostice XtremeFontEngine 1.0.0.102
Gnostice XtremeFontEngine 1.0.0.102 | 2 Mb


Whenever a developer tries to use a component or a tool that renders text, then he/she has to deal with fonts. Whether the component is a GUI control such as a text label or a text box, or a non-GUI component that renders text on a printer canvas, it must be able to process fonts. Here, the choice of fonts that can be used with the component is limited to those that are installed on the system and also by the font types supported by the run-time environment (.NET and JRE). What if you wanted to use a font that is not installed or if you wanted to use a font type that is not supported by the run time?

Suppose you were going to create a Photoshop-on-the-web kind of application. How would you render text using fonts uploaded by the users? You can't just install any font file that is uploaded by users. Even if it were possible, doing so would be a security risk. Let us take another example, suppose you wanted to create a PDF viewer application. You will find that .NET or JRE can handle only complete fonts, not subset-embedded fonts, non-TrueType fonts and non-OpenType fonts that are typically found in PDF documents.

Thus, a need for advanced font processing becomes necessary. A popular solution for this need is the FreeType font engine. FreeType does a splendid job but it is a "C" library. If you used it in a .NET or Java application, you will not be able to label the application as 100% Java or 100% .NET software. Even if you could care less about labeling, there are situations where you wouldn't be allowed to make native Win32/Win64 calls to the FreeType library. A common example of such a situation is a ASP.NET website running under medium-trust on a shared-hosting server.

It is for these reasons that we created XtremeFontEngine. XtremeFontEngine will be a valuable addition to the toolbox of any Java/.NET developer. XtremeFontEngine enables you to process several types of fonts, and retrieve their font properties and glyph information. You will then be able to render those glyphs on a graphics surface. XtremeFontEngine supports most of the capabilities of FreeType and brings all the advantages of being a pure .NET or Java library. You can use it in all your desktop and web applications without any hassle or restrictions. It can independently provide the host application with all the font properties and glyph information that a font file/stream contains.

XtremeFontEngine

XtremeFontEngine .NET is a 100% .NET font engine and XtremeFontEngine (for Java) is a 100% Java font engine. XtremeFontEngine can read fonts and obtain glyph outlines at various sizes. This information can be used to create reusable vector and raster graphic objects for each glyph. Specifically, XtremeFontEngine features include:

Ability to retrieve outlines for specified glyph ID, glyph name, character code
Ability to retrieve font properties - name, family, style, line gap, ascent, descent, supported encodings
Ability to load fonts from files and streams
Support for Type 1, Type 2 (CFF), TrueType fonts
Support for TrueType collections
Support for TrueType outlines in OpenType fonts
No external dependencies - it is a fully self-contained engine with no dependencies outside .NET framework or JRE run time.

private void button1_Click(object sender, EventArgs e) {
  listBox1.Items.Clear();
  listBox2.Items.Clear();

  // Prompt user to select a font
  if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
    // Update check box with file pathname
    textBox1.Text = openFileDialog1.FileName;

    try {
      // Initialize font object with font selected by user
      font1 = FontFactory.Load(textBox1.Text, "your-license-key");
    } catch (Exception err) {
      MessageBox.Show("Error: " + err.Message);
      return;
    }
    this.Text = "XFE Demo - " + font1.FontName;

    // Obtain encodings supported by the font
    List<EncodingType> lstEncoding = font1.GetSupportedEncodings();

    if (lstEncoding != null) {
      // Populate list box with supported font encodings
      foreach (EncodingType et in lstEncoding) {
        listBox1.Items.Add(et.ToString());
      }
    } else {
      listBox1.Items.Add("None");
    }

    // Automatically select an encoding
    listBox1.SelectedIndex = 0;

    // Retrieve all glyphs in the font file
    SortedDictionary<int, string> sd = font1.GetGlyphIdNameDict();

    // Populate other listbox with retrieved glyph names
    foreach (KeyValuePair<int, string> kvp in sd) {
      listBox2.Items.Add(kvp.Value);
    }

    // Set flag for SelectedIndexChanged event handler of list box
    bReady = true;

    // Automatically select a glyph name
    listBox2.SelectedIndex = 0;
  }
}


Home:
http://www.gnostice.com/nl_article.asp?id=235&t=Introduction_To_Fonts_and_the_New_Gnostice_Font_Engine_XtremeFontEngine


Restriction: If you have have ONE TEAR or more than ONE TEAR VIP membership please mail us for password.


Only for V.I.P
Warning! You are not allowed to view this text.