All Products
Search
Document Center

Function Compute (2.0):How do I use custom fonts in Function Compute?

Last Updated:Jul 11, 2023

If the built-in fonts of Function Compute runtime environments cannot meet your business requirements, you can customize fonts for your applications. This topic describes how to install custom fonts in the Function Compute console.

Before you begin

  • A service and a function are created.

    For more information, see Create a service and Create a function.

  • The sample code for custom fonts is downloaded.

    In this example, the function code is written in Python. For the sample code of the Python runtime, see Python examples.

Procedure

  1. Log on to the Function Compute console. In the left-side navigation pane, click Services & Functions.
  2. In the top navigation bar, select a region. On the Services page, click the desired service.
  3. On the Functions page, click the name of the desired function. On the function details page, click Upload Code and select a method to upload the code.

    The following figure shows the code directory after the upload is complete. Tangerine-xxx.ttf is a custom font file. You can add other custom font files based on your business requirements. fonts-demo

  4. Install the FONTCONFIG_FILE = /code/fonts.conf environment variable for the function.

    fonts.conf is a font configuration file. After this environment variable is installed, the function runtime can read the custom font directory.

  5. Click Test Function to run the function to install the font.

    After the execution is complete, check the log. style=Regular and style=Bold indicate that the installed fonts have taken effect. install-fonts-result