diegomura / react-pdf

📄 Create PDF files using React
https://react-pdf.org
MIT License
14.34k stars 1.13k forks source link

Adding Naira symbol "₦" showing "¦" #2654

Open Tnaike opened 3 months ago

Tnaike commented 3 months ago

Describe the bug I tried adding a naira symbol "₦" but not showing the symbol. Have tried using HTML Entity: (₦) and still didn't get the symbol.

Expected behavior I want to see the Naira symbol (₦). ₦5200. Have tried using HTML Entity: (₦) and still didn't get the symbol.

Screenshots If applicable, add screenshots to help explain your problem. image

Desktop (please complete the following information):

diegomura commented 3 months ago

Are you using a font that has that glyph?

Tnaike commented 3 months ago

Are you using a font that has that glyph?

@diegomura Yes, I'm using "Roboto".

import { Document, Font, Image, Page, StyleSheet, Text, View } from '@react-pdf/renderer';

Font.register({
  family: 'Roboto',
  fonts: [
    {
      src: 'https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-regular-webfont.ttf',
      fontWeight: 400,
    },
    {
      src: 'https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-medium-webfont.ttf',
      fontWeight: 500,
    },
  ],
});
ibmeshach commented 2 months ago

I am facing the same issue, please help

muzardemoses commented 2 months ago

Anyone with a solution?

muzardemoses commented 2 months ago

Import font as custom file worked for me import font from '../../../fonts/static/Inter-Medium.ttf' Font.register({ family: 'Inter', src: font });

MHMighani commented 2 months ago

Are you sure that Roboto has this character's glyph? @Tnaike

I can't find it in this list: https://github.com/googlefonts/roboto/blob/main/res/glyphlist.txt