diegomura / diegomura/react-pdf

Ellipses appear with some fonts, but not others

Open
#1,749 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

**Describe the bug**

When using the Google Font, "[Roboto Slab](https://fonts.google.com/specimen/Roboto+Slab?preview.text_type=custom#glyphs)," the generated PDF does not include an ellipsis when the text overflows its container.

![image](https://user-images.githubusercontent.com/7143133/158688787-7135da21-ebc5-42c0-a8df-b2427424d5fa.png)

**To Reproduce**

[**Here is a link to the REPL shown above**](https://react-pdf.org/repl?code=3187b0760ce02e0040a200f021816c00e01b0298c0bc3002804a3c03e420281860078011118015c52cc294abada005240732c9dbb71a0054b0258d0027b65c01bd6760800e89005f6123b80417dfa600211326600614b9661d5bb7e1c4770b889a01e8254edaf3f4a872b11594b0d4008cb45c740d0d4cccadacedec9d1d23a9dd7dbd68dcf905b5dc199959d9388801b8282a00c5c0a154009cb1f8012da0b0ea081460b800cd509a306400b86000880094414240a040600194309142460068bba820eb818646002ca0a0d02106dcddba6ad5f9a090a09b81554050dc20dceb27a640211742dc00dc00d8dc32003b36142006b0015bf0c67023000a400d2004e7f800d4008a4d0033302005a6800031c17468a921200e284d0934e0ec3400059b118a83fce0aa03b7446140d1942aa0481f802103c3cdfcd839aecb0585ab001a372c074b8486182922a7180015420382814a6000132c2f498185839dd8aa4885aa07326800bcb0c306400385691141201000192698042c300233ba44504914000f2bf36b743020003b8ecb0180c1348e2d5597034219828555eab716a7530240c02920103f1b0301b55a4436ca9f406c3003904ca63379b7c5b6b6b4d4ed8ee75ba3d5edf7fb8e3060e44c35228cc6e389d1b2753e988267a8d99e5f228632c12180501e1d12af53611bda34442a1303837290f9400000), in which I demonstrate the issue. In that REPL, I define two `Text` elements, each one having `maxLines` of `1`, and each one having more than one line worth of child text.

**Expected behavior**

I expected both `Text` elements to be rendered with an ellipsis at the end (i.e. `...`). However, only the first `Text` element is rendered that way; the second one is not.

**Screenshots**

(See above)

**Desktop (please complete the following information):**
- OS: Windows 10
- Browser: Brave Version 1.36.112 Chromium: 99.0.4844.51 (Official Build) (64-bit)
- React-pdf version: React-PDF Repl 2.1.0

---

I see several closed issues (e.g. https://github.com/diegomura/react-pdf/issues/461, https://github.com/diegomura/react-pdf/issues/698) and merged PRs (e.g. https://github.com/diegomura/react-pdf/pull/570, https://github.com/diegomura/react-pdf/pull/1437) related to ellipses.

A comment in Issue #698 says:
> This is because the [...] font [...] does not contain the ellipsis character.

In case the underlying issue in this case is that the "Roboto Slab" font does not include an ellipsis character, is there a way the developer (i.e. the person using ReactPDF) can choose to substitute a different character(s) of the same font in place of the ellipsis? For example, I think I would use three periods (i.e. "`...`" or `<>...`).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.