Text to Vector in C#
Vectorize text in SVG documents and save it as vector graphics
Convert Text to Vector Paths
Text vectorization is the process of converting text into a variety of vector paths and geometrical forms. You can use different fonts and then convert them into vector outlines creating your own vector fonts. Such a text become a vector drawing and cannot be edited in the text editor. But you can edit and customize the vector characters by manipulating of <path>
, <use>
, <mask>
, <g>
elements in SVG code. You can apply the “filter”, “mask”, “opacity”, and other effects to the vectorized SVG text customizing its features such as opacity, lighting effects, etc. In addition to this, you can transform borders, strokes, shadows, glows, and other SVG aspects that can help you to design text. You can play with all these SVG features to get the best results. The vectorized text, being vector graphics, allows fonts usage without installation on the client computer and retains its style when used in any computer environment. Thus, converting text to vector forms is very helpful for use in logos, icons, banners, advertisements, etc.
Aspose.SVG for .NET API provides the feature of text vectorization in SVG documents. Check out our C# library so you can convert SVG text to vector graphics with ease!
C# code example to vectorize text in an SVG document
In the vectorized SVG text, all font glyphs are replaced to a combination of graphics elements. Aspose.SVG for .NET API provides the feature of vectorizing text elements in SVG documents. To vectorize text, set the
VectorizeText
property of the SVGSaveOptions class to true
. Text vectorization can be done with a few lines of code:
Convert text to vector – C#
// Load an SVG document from a file
var document = new SVGDocument(InputFolder + "text.svg");
// Create a Save Options object
var saveOptions = new SVGSaveOptions
{
VectorizeText = true
};
// Save the SVG document with specified saveOptions
document.Save((OutputFolder + "text-vectorized.svg"), saveOptions);
Steps to vectorize SVG text in C#
- Load an SVG document using one of the SVGDocument() constructors.
- Create a new instance of the SVGSaveOptions class. Use the
SVGSaveOptions()
constructor and set the
VectorizeText
property as
true
. It points to replacing text elements with paths. - Call the Save() method and pass to it the output path and save options object.
In the documentation chapter Vectorization – Basic Overview, you will find text vectorization info, learn how to vectorize text in SVG document and consider C# examples. In the documentation article Text Vectorization & Text Security, you will know about text vectorization advantages.
Online Text Vectorizer
Aspose.SVG offers a free online Text to Vector App that converts text in SVG file into vector forms. Text to Vector works from any device, any platform. No registration, plugin or additional software installation is required for you. Convert your SVG text to vector and get all advantages of vector graphics!
FAQ
1. What is SVG text?
The <text>
element is used to define a text. SVG text content elements are rendered like other graphics elements. Thus, coordinate system transformations, painting, clipping, and masking features apply to ‘text’ elements similarly to shapes such as paths and rectangles. SVG text content elements have font-family, font-size, font-weight, end other attributes in which you can set font properties. The vectorized text has no font and glyph concepts, only paths, shapes, etc.
2. What does text vectorization mean?
In vectorized SVG text, all font glyphs are replaced by a combination of XML text tags such as <path>
, <use>
, <g>
, etc. The text is converted to vector shapes and cannot be edited. This prevents casual users from opening and editing this file in a text editor.
3. How can I convert text to vector?
Aspose.SVG allows you to vectorize SVG text in any way – online or programmatically. You can convert text to vector in real-time using Online Text to Vector application that vectorizes your text in SVG file quickly and with high quality. On other hand, you can use Aspose.SVG for .NET API to vectorize text programmatically.
Get Started with Aspose.SVG for .NET API
If you are interested in developing scalable vector graphics and their application, install our flexible, high-speed Aspose.SVG for .NET API with a powerful set of interfaces for C# and other .NET programming languages.Install from command line as
nuget install Aspose.SVG
or via Package Manager Console of Visual Studio with Install-Package Aspose.SVG
.
Alternatively, get the offline MSI installer or DLLs in a ZIP file from
downloads.
Aspose.SVG for .NET API is a standalone library and does not depend on any software for SVG document processing.For more details about C# library installation and system requirements, please refer to Aspose.SVG Documentation.