Customizing fonts for your Pega application
+
This content applies to On-premises, Client-managed cloud and Pega Cloud environments
Pega Platform™ supports importing web fonts for use in your Pega application. You might want to import a new web font into your Pega application if the standard Pega font set does not include an icon required for your application, or if you must maintain consistency in accordance to your company style guide for your customer-facing interface of your application, or if your designs require a specific typography that is incompatible with Pega application defaults fonts.
Pega Platform supports implementing custom web fonts for different purposes using different file formats. Most modern browsers use .woff2
. Internet Explorer 11 exclusively uses .woff
. Mobile clients must implement the .ttf
(TrueType) version of web fonts.
To incorporate custom web fonts into Pega Platform for use in your Pega application, perform the following procedure:
- Download the respective binary files for the fonts that you want to add to your skin from an online font repository. Ensure that you download at least the
.woff
version of the fonts. Using a text editor, create a text file for use as the custom cascading style sheet (CSS).
In the CSS text file, add a font-face snippet by using the following format:
For Pega Platform 8.4 and later:src: (webwb/fontName.fontformat)
For Pega Platform 8.3 and earlier:src: (webwb/fontName.fontformat?)
Enter the source URL element. Only add the src element for the first font definition.
Example:src: url
Enter the directory of the imported font.
Example:(webwb/
Enter the font name.
Example:newFontNormal
Enter the font file type. This is the same as the font format.
Example:.woff)
Define the font format.
Example format:('woff')
,Return to step 3a. as needed to define each font that you want to add to your Pega application.
Use the same font family for all the types of fonts; otherwise Pega Platform cannot recognize them.
Example of a font-face snippet:
@font-face {
font-family: newFontNormal;
src: url(webwb/newFontNormal.woff2) format ('woff2'),
url(webwb/newFontNormal.woff) format ('woff'),
url(webwb/newFontNormal.ttf) format('ttf'),
font-weight: normal;
font-style: normal;
}
Upload the fonts to Pega Platform:
In the header of Dev Studio, select Create > Technical > Binary File to create binary files for the
.ttf
,.woff
, or.woff2
.In the App Name (Directory) field, enter
webwb
.In the File Type (Extension) field, enter the corresponding font format (
.ttf
,.woff
, or.woff2
).In the fields located under the Context section, select the application and ruleset to which the skin you want to edit belongs.
Click Create and open.
In the File controls section, click Upload file and select the corresponding font file.
Click Save.
Repeat step 4a. as needed to create binary files for each corresponding
.ttf
,.woff
, or.woff2
files you want to add to Pega Platform.
Upload the CSS file to the skin for the Pega application:
In the navigation panel of Dev Studio, click Records > Application.
In the Presentation section, in the Skin field, click the properties icon.
Select the application into which you want to upload the custom fonts.
In the Skin rule form, click the Included styles tab.
In the Additional style sheets section, click + Add style sheet.
To the right of the new empty field, click the properties icon.
In the label field, enter a short description for the new style sheet.
In the fields located under the Context section, select the application and ruleset to which the skin belongs.
Click Create and open.
Click Upload file and select the new CSS file that you created.
Click Save.
Return to the Skin rule form and click Mixins.
In the Typography section, click General.
In the Font family list, select other.
The rule form displays the font family name in the Font family name field.Click Save.
When the user portal opens, confirm that the skin displays the custom font.
For more information about importing web fonts, see the following topics: