This is a migrated thread and some comments may be shown as answers.

FontName displayed in drop down

1 Answer 65 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Brete
Top achievements
Rank 1
Brete asked on 26 Mar 2010, 10:09 PM

problem with custom fonts in the drop down.

My Radeditor component contains the following.

 

 

<FontNames>

 

 

 

<telerik:EditorFont Value="SomeFont1" />

 

 

 

<telerik:EditorFont Value="SomeFont2" />

 

 

 

<telerik:EditorFont Value="SomeFont3" />

 

 

 

</FontNames>

However, no matter what font is chosen the text in the dropdown box says Arial.    If I examine the content it is updating to the selected font. (ie: <FONT face="SomeFont1">dfsdfasdfasdfasdf</FONT>)  Only the text rendered in the dropdown says Arial.  

Note, that the fonts being chosen do not actually exist on the computer.  The content is being captured for an offline printing application, where the user chooses the font(s) the content will print in. 

Does the editor require the chosen font to exist on the client computer? 

Since, I dont what the user to think that the content will print in Arial.  Is there a way to make the box say "Default" instead of "Arial"? 



 

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 29 Mar 2010, 02:08 PM
Hello Brete,

Тhe dropdown header displays the information returned by the browser's queryCommandValue method. If you want to achieve your scenario you should use the code below that obtains the font name of the select content and sets it in the header of the FontName dropdown:

<script type="text/javascript">
    function OnClientSelectionChange(editor, args) {
        var tool = editor.getToolByName("FontName");
        if (tool) {
            setTimeout(function() {
                tool.set_value(editor.getSelectedElement().face);
            }, 0);
        }
    }
</script>
 
<telerik:RadEditor ID="RadEditor1" runat="server" OnClientSelectionChange="OnClientSelectionChange">
    <FontNames>
        <telerik:EditorFont Value="SomeFont1" />
        <telerik:EditorFont Value="SomeFont2" />
        <telerik:EditorFont Value="SomeFont3" />
    </FontNames>
    <Content>
        <span style="font-family:SomeFont1">text</span><br />
        <span style="font-family:SomeFont2">text</span><br />
        <span style="font-family:SomeFont3">text</span><br />
    </Content>
</telerik:RadEditor>


Best regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Editor
Asked by
Brete
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or