Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#12563 closed Bug (duplicate)

Font names containing spaces and numbers are not handled well.

Reported by: Zoltan Koszegi Owned by:
Priority: Normal Milestone:
Component: General Version: 4.4.1
Keywords: Oracle Cc:


We use CK editor embedded in a web browser control. We also extend the CK predefined font stacks with system fonts. This system font list contains some entry that has space and numbers in its name, for instance 'Bauhaus 93'. We are facing an issue that 'Bauhaus 93' is displayed in the font combobox even if the underlying font is different. We also realized that in the related CK font style an empty string presented instead of the 'Bauhaus 93'. After some investigation we found this on W3Schools: 'If a font name contains white-space, it must be quoted. Single quotes must be used when using the "style" attribute in HTML.'. So, officially every font name that has a white space in its name should be single quoted. In fact, this is not necessary for names that has *no* numbers in its name, for instance 'Courier New' but should be used on font names that *has* number in its name like 'Bauhaus 93'. So, we tried to fix this by putting 'Bauhaus 93' between single quotes.

This is the original font configuration (just a sample): config.font_names = "Arial;Bauhaus 93/Bauhaus 93;Tahoma;Verdana";

This is the modified one according to the W3Shools recommendation: config.font_names = "Arial;Bauhaus 93/'Bauhaus 93';Tahoma;Verdana";

On one hand the font combobox now reports the right font where the cursor is. This is ok, but on the other hand, when we try to assign a font that contains a number just like 'Bauhaus 93' the CK editor somehow removes the quotes and generates this style: <span style="font-family:Bauhaus 93;">text</span> -> No single quotes. This is incorrect and browsers do not handle well. This form would be the correct one: <span style="font-family:'Bauhaus 93';">text</span>

Would you please investigate/fix why CKEditor stripes down the 'Bauhaus 93' and put these types of names without quotes in the HTML source. We are using IE engine because of the webbrowser control.

Additional notes about our investigation. This issue is IE specific and the following javascript code is affected: In the the function parseCssText there is two lines:

1) temp.setAttribute( 'style', styleText );

2) styleText = temp.getAttribute( 'style' )

WITHOUT QUOTES: If the styleText variable contains: Bauhaus 93 (*no* single quotes), then the getAttribute in the second line returns with an empty string. So the result is that the style definition created for 'Bauhaus 93' will be empty and later every style matching will say the font is 'Bauhaus'.

WITH QUOTES: If the styleText variable contains: 'Bauhaus 93' (between quotes), the getAttributes works well and the subsequent style matcing gives the right values. This is ok. The problem comes when we apply this style to a text. The quoutes are removed. This is what you need to investigate (The codes I referred works well.). The testing is simple. Just put 'Bauhaus 93' font definition (with single quotes) among the other fonts in the config: This is the full offcial entry for this font: Bauhaus 93/'Bauhaus 93' Note, not just the 'Bauhaus 93' is affected but every other font name that has numbers in its name.

Regards, Zoltan

Change History (3)

comment:1 Changed 9 years ago by Craig Fitzpatrick

Running into this one too.

comment:2 Changed 8 years ago by Jakub Ś

Resolution: duplicate
Status: newclosed

I have decided to close this ticket as DUP of #10750 and make the #10750 general ticket for this problem.

comment:3 Changed 7 years ago by Jan Aagaard

Digits are allowed as long as the word in the font does not start with a digit. Details here:

  • Does not require quotes: Museo W01_500
  • Quotes required: Shree Devanagari 714
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy