Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read_docx does not respect embedded fonts #554

Open
vorpalvorpal opened this issue Mar 6, 2024 · 3 comments
Open

Read_docx does not respect embedded fonts #554

vorpalvorpal opened this issue Mar 6, 2024 · 3 comments
Labels

Comments

@vorpalvorpal
Copy link

Problem

Word allows fonts to be embedded in .docx documents, however read_docx does not support this

Reprex

  • Create test.docx
  • Go to options > save> embed font and then save the document.
x <- officer::read_docx("test.docx")
print(x, target = "test2.docx")
  • test2.docx will not have embedded fonts.

Related

See officedown issue 137

@vorpalvorpal
Copy link
Author

On further investigation I think the problem is actually with word/settings.xml so that, although officer includes the embedded fonts, the embedded font setting isn't chosen meaning that the fonts are lost as soon as the document is opened and auto-saved. I have a basic fix that I'll post when I'm back on my main computer next week.

@davidgohel davidgohel added the bug label Mar 7, 2024
@vorpalvorpal
Copy link
Author

vorpalvorpal commented Mar 11, 2024

I've just put in a PR with my fix.

read_docx checks to see if there are embedded fonts. If there are, it looks up what the embedded font save settings are and copies these settings using docx_settings.

This is my first pull request, so if I've done something wrong, I apologise.

@davidgohel
Copy link
Owner

davidgohel commented May 5, 2024

don't need to apologise :)

But I did try to add this feature in the past without success and your PR did not work for me neither.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants