PptxGenJS icon indicating copy to clipboard operation
PptxGenJS copied to clipboard

Text is duplicating for the "Jost Light" font style while creating PPT using PptxGenJs library

Open SureshMetacube opened this issue 2 years ago • 3 comments

Steps:

  1. we have created a sheet in which we have used "Jost Light / Jost Light (Body)" font for description.
  2. when we move to another slide and came back to the slide then it shows duplicate text.
  3. when we edit or remove the duplicate created text then it edits the original text only. So it seems that this issue not actually creating duplicate text but it is showing duplicate.
  4. This issue is only with Office 365 and this font style.

please find a screenshot and PPT as a reference test_sample.pptx . image

SureshMetacube avatar Oct 27 '23 12:10 SureshMetacube

I can reproduce this with any custom font. It seems dependent on the width of the text box, as well as other items on the page.

ChillyBots avatar Mar 05 '24 12:03 ChillyBots

@SureshMetacube Looks like it's down to this line:

https://github.com/gitbrent/PptxGenJS/blob/035cf6b26239e2ea1f27eefbcdb8134e504eb4f4/src/gen-objects.ts#L1062

It's automatically adding wrap true when we aren't explicitly setting it. Updating to this fixes the issue:

if (typeof itemOpts.wrap === 'boolean') { itemOpts._bodyProp.wrap = itemOpts.wrap; }

Of course, if you set wrap true again, the issue will return

ChillyBots avatar Mar 06 '24 12:03 ChillyBots

Apologies, the above solution is incorrect. This disables all wrapping, which is not desired. it is infact this line causing the error:

https://github.com/gitbrent/PptxGenJS/blob/035cf6b26239e2ea1f27eefbcdb8134e504eb4f4/src/gen-xml.ts#L998

reverting the fix for #174 fixes the issue (change charset to 0). This obviously breaks 174, so I suppose this is a toss-up for anyone forking

ChillyBots avatar Mar 07 '24 14:03 ChillyBots