1. Products
  2.   Font
  3.   JavaScript
  4.   Aspose.Font for JavaScript via C++

Aspose.Font for JavaScript via C++

 
 

JavaScript Font API to Load, Save & Convert Fonts

JavaScript API enables software developers to Create & Manage Rich Applications, to Load, Encode, Save & Convert TrueType, CFF, OpenType, & Type1 within JS Apps.

In today's fast changing world of software development, efficiently managing typefaces is critical for producing visually beautiful and accessible apps. Aspose.Font for JavaScript via C++ is a strong solution that addresses this demand by providing JavaScript developers with robust font editing features. This API connects JavaScript and C++, delivering a unified experience for font management and rendering. The API can easily load, read, draw, and save a variety of font formats, including TrueType, WOFF, EOT, OpenType, CFF, Type1, and many others.

One of the most appealing features of Aspose.Font for JavaScript via C++ is its cross-platform portability. Developers can use C++ APIs to embed font modification capabilities directly into JavaScript apps. This strategy not only improves performance but also assures that programs run smoothly across a variety of settings, ranging from browsers to server-side configurations. It includes a variety of features and capabilities that make font editing easier. Developers may easily access and adjust font parameters such as font size, family, style, and color with just a few lines of code when JavaScript is integrated via C++ APIs.

Furthermore, Aspose.Font streamlines font loading and rendering, allowing developers to show text in a variety of fonts across several platforms and devices. In addition to its powerful features, the API provides extensive documentation and support tools, such as tutorials, samples, and forums, to assist developers get started with the tool quickly and efficiently. Furthermore, its licensing strategy is developer-friendly, with options that cater to both individual developers and large companies. Whether you're creating a web application, a graphic design tool, or a document processing system, Aspose.Font gives you the tools you need to work with fonts precisely and efficiently.

Previous Next

Getting Started with Aspose.Font for JavaScript via C++

The recommend way to install Aspose.Font for JavaScript via C++ is using NuGet. Please use the following command for a smooth installation.

Install Aspose.Font for JavaScript via C++ via NuGet Command

 NuGet\Install-Package Aspose.Font.Cpp -Version 24.7.0

You can download the library directly from Aspose.Font for JavaScript via C++ product page

Better Font Handling via JavaScript API

Aspose.Font for JavaScript via C++ has provided complete support for loading and reading popular font file formats inside JavaScript applications. The API works with various font formats, including TrueType (TTF), OpenType (OTF), Type 1 and many more. This versatility that software developers can integrate a wide range of fonts into their applications, enhancing both the aesthetic and functional aspects. The following example demonstrates how to load a TrueType font using Aspose.Font and retrieve basic font information, such as the font name.

How to Load a TrueType Font inside JavaScript Apps?

#include 
#include 
#include 
#include 

using namespace Aspose::Font;
using namespace Aspose::Font::TrueType;

int main() {
    // Path to the font file
    System::String fontPath = u"Path/to/font.ttf";
    
    // Loading the font
    System::SharedPtr fontDefinition = System::MakeObject(FontType::TTF, System::MakeObject(fontPath));
    System::SharedPtr font = System::MakeObject(fontDefinition);
    
    // Access font details
    System::String fontName = font->get_FontName();
    std::cout << "Font Name: " << fontName.ToUtf8String() << std::endl;

    return 0;
}

Convert Font to Other Formats via JavaScript API

One of the standout features of Aspose.Font is its ability to convert fonts between different formats. This capability is crucial for maintaining consistency across various platforms and devices. This code snippet demonstrates how to convert a TrueType font to an OpenType font using Aspose.Font. Such conversions are essential for developers who need to support different font formats in their applications, ensuring compatibility and maintaining design integrity.

How to Convert a TrueType Font to an OpenType Font using JavaScript API?

#include 
#include 
#include 
#include 
#include 

using namespace Aspose::Font;
using namespace Aspose::Font::TrueType;
using namespace Aspose::Font::OpenType;

int main() {
    // Path to the TrueType font file
    System::String ttfPath = u"Path/to/font.ttf";
    
    // Loading the TrueType font
    System::SharedPtr ttfDefinition = System::MakeObject(FontType::TTF, System::MakeObject(ttfPath));
    System::SharedPtr ttfFont = System::MakeObject(ttfDefinition);
    
    // Converting to OpenType
    System::SharedPtr otfFont = System::MakeObject(ttfFont);
    
    // Saving the converted font
    otfFont->Save(u"Path/to/converted-font.otf");

    return 0;
}

Advanced Typography Support

Aspose.Font for JavaScript via C++ has included complete support for advanced typographic features, including kerning, ligatures, and multilingual text rendering. These features are crucial for developers aiming to create high-quality, professional-grade text layouts. The below code example illustrates how to access kerning information between two characters inside JavaScript applications. Such detailed typographic control allows developers to fine-tune text spacing and layout, which is especially important in professional typesetting and design applications.

How to Access Font Kerning Information via JavaScript API?

  
#include 
#include 
#include 

using namespace Aspose::Font;
using namespace Aspose::Font::TrueType;

int main() {
    // Path to the TrueType font file
    System::String fontPath = u"Path/to/font.ttf";
    
    // Loading the TrueType font
    System::SharedPtr fontDefinition = System::MakeObject(FontType::TTF, System::MakeObject(fontPath));
    System::SharedPtr font = System::MakeObject(fontDefinition);
    
    // Accessing kerning information
    System::SharedPtr kerningTable = font->get_KerningTable();
    double kerningValue = kerningTable->GetKerningValue(u'V', u'A');

    std::cout << "Kerning between V and A: " << kerningValue << std::endl;

    return 0;
}

Performance and Efficiency

By integrating the power of C++, Aspose.Font for JavaScript via C++ ensures high performance and efficient memory usage. This is crucial for applications that require real-time font rendering and manipulation, such as interactive web applications and games. Develop advanced graphic design tools that allow users to manipulate fonts, create custom typographic designs, and export them in various formats.