Skip to content

Chevin font corrupts text copy pasted from PDF #629

@anttikekki

Description

@anttikekki

Describe the bug
Chevin font corrupts text copy pasted from PDF.

To Reproduce

const Test = () => (
  <Document>
    <Page>
      <View>
        <Text style={styles.roboto}>
          The Portable Document Format (PDF) (redundantly: PDF format) is a file format developed by Adobe in the 1990s to present documents, 
          including text formatting and images, in a manner independent of application software, hardware, and operating systems.[2][3] 
          Based on the PostScript language, each PDF file encapsulates a complete description of a fixed-layout flat document, including the 
          text, fonts, vector graphics, raster images and other information needed to display it. PDF was standardized as an open format, 
          ISO 32000, in 2008, and no longer requires any royalties for its implementation.
        </Text>
        <Text style={styles.chevin}>
          The Portable Document Format (PDF) (redundantly: PDF format) is a file format developed by Adobe in the 1990s to present documents, 
          including text formatting and images, in a manner independent of application software, hardware, and operating systems.[2][3] 
          Based on the PostScript language, each PDF file encapsulates a complete description of a fixed-layout flat document, including the 
          text, fonts, vector graphics, raster images and other information needed to display it. PDF was standardized as an open format, 
          ISO 32000, in 2008, and no longer requires any royalties for its implementation.
        </Text>
      </View>
    </Page>
  </Document>
);

Font.register(
  {src: 'https://pdf-font-test.s3.eu-central-1.amazonaws.com/Chevin-Light.ttf',
  family: 'Chevin' },
);

Font.register(
  {src: 'https://pdf-font-test.s3.eu-central-1.amazonaws.com/Roboto-Light.ttf',
  family: 'Roboto' },
);

const styles = StyleSheet.create({
  roboto: {
    fontFamily: 'Roboto'
  },
  
  chevin: {
    fontFamily: 'Chevin'
  }
});

ReactPDF.render(<Test />);

REPL link

Expected behavior
Text copy pasted from PDF from Chevin font paragraph should equal the Roboto version:

The Portable Document Format (PDF) (redundantly: PDF format) is a file
format developed by Adobe in the 1990s to present documents, including
text formatting and images, in a manner independent of application software,
hardware, and operating systems.[2][3] Based on the PostScript language,
each PDF file encapsulates a complete description of a fixed-layout flat doc-
ument, including the text, fonts, vector graphics, raster images and other in-
formation needed to display it. PDF was standardized as an open format, ISO
32000, in 2008, and no longer requires any royalties for its implementation.

Actual behavior
Copy pasted text from PDF from Chevin paragraph is corrupted:

The Portable Document Format (PDF) (redundantly: PDF format) is a vle format depeloAed 
by 1dobe in the 900,s to Aresent documentsg includinx tewt formattinx and imaxesg in a 
manner indeAendent of aAAlication soft.areg hard.areg and oAeratinx systems[2]32B3 Sased 
on the Post-criAt lanxuaxeg each PDF vle encaAz sulates a comAlete descriAtion of a 
vwedzlayout Iat documentg includinx the tewtg fontsg pector xraAhicsg raster imaxes and 
other information needed to disAlay it[ PDF .as standardiOed as an oAen formatg 8-q B],,,g in 
],,􏰃g and no lonxer re􏰄uires any royalties for its imAlementation[

Edit: rendering is also corrupted for Chevin paragraph:
chevin-rendering-bug

Desktop:
* OS: MacOS
* Browser: Firefox 67
* React-pdf version: REPL at 2019-06-06 v1.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions