Skip to content

[Docs]: Invalid specification for Noto Sans font #499

@suzuki-shm

Description

@suzuki-shm

Describe the Issue
There is an error in the current configuration of Noto Sans for OG Image generation. When this configuration is used, an error occurs because the corresponding Google Fonts page does not exist.

Proposed Changes
You can avoid the error by making the following changes. Simply, remove :wght@700 from font property.

// file: loadGoogleFont.ts

async function loadGoogleFonts(
  text: string
): Promise<
  Array<{ name: string; data: ArrayBuffer; weight: number; style: string }>
> {
  const fontsConfig = [
    {
      name: "Noto Sans JP",
      font: "Noto+Sans+JP",
      weight: 400,
      style: "normal",
    },
    {
      name: "Noto Sans JP",
      font: "Noto+Sans+JP",
      weight: 700,
      style: "normal",
    },
    { name: "Noto Sans", font: "Noto+Sans", weight: 400, style: "normal" },
    {
      name: "Noto Sans",
      font: "Noto+Sans",
      weight: 700,
      style: "normal",
    },
  ];
  // other codes
}

Additional Context
When the error occurs, accessing the URL obtained by parsing the API variable leads to a page like the one below.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions