Skip to content

Conversation

@tjinauyeung
Copy link

@tjinauyeung tjinauyeung commented Aug 24, 2022

This PR adds an addFonts method which enables external fonts to be added to the PPTX.

How to test

  1. Pull changes
  2. Bundle lib - npm run ship
  3. Run demos - cd demos; node ./browser_server.mjs
  4. Try out API

Example:

pptx.addFonts([
  { 
    name: "Roboto",
    styles: [
      { name: "regular", path: "http://localhost:8080/roboto-regular.fntdata" },
      { name: "bold", path: "http://localhost:8080/roboto-bold.fntdata" }
    ]
  }
])

In order to pass a valid path to .fntdata files you can serve them locally. Note: consider CORS when serving.

Follow up

  • Build JS assets to dist
  • Add new tag
  • Include in pptx-exporter

@tjinauyeung tjinauyeung force-pushed the switch/add-font-face-2 branch 3 times, most recently from d73a388 to 3d2807f Compare August 25, 2022 07:50
@tjinauyeung tjinauyeung changed the title wip allow external fonts Aug 25, 2022
@tjinauyeung tjinauyeung self-assigned this Aug 25, 2022
@tjinauyeung tjinauyeung marked this pull request as ready for review August 25, 2022 07:54
@tjinauyeung tjinauyeung changed the title allow external fonts Allow external fonts to PPTX Aug 25, 2022
@zarkone
Copy link

zarkone commented Aug 25, 2022

updated "how to test"

@tjinauyeung tjinauyeung force-pushed the switch/add-font-face-2 branch from 3d2807f to cffe117 Compare August 25, 2022 12:08
strXml +=
'<Relationship Id="rId' + ++intRelNum + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="slides/slide' + idx + '.xml"/>'
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooff this index thingy is not pretty!

@tjinauyeung tjinauyeung merged commit 6704259 into pitch-main Aug 29, 2022
@tjinauyeung tjinauyeung deleted the switch/add-font-face-2 branch August 29, 2022 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants