Changing font globally


Author
Message
Neil Turp
Neil Turp
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)
Group: Forum Members
Posts: 0, Visits: 166
I have an app where the user is allowed to change the font name/size of a file completely.  I know all formatting is lost but this is what the users want.  The code I am using is

NRichTextView mmdv = new NRichTextView()
...
mmdv.Content.Selection.SelectAll();
mmdv.Content.Selection.SetFontSizeToSelectedInLines(24.0);
mmdv.Content.Selection.DeselectAll();

but that doesn't work.  I've also tried stepping through the Sections
for (int a = 0; a < mmdv.Content.Sections.Count; a++)
{
  mmdv.Content.Sections[a].FontName = "Cochin";
etc
}
Nothing works.  Obviously I've misunderstood something somewhere but can anyone throw light on it?
Neil

Replies
Neil Turp
Neil Turp
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)
Group: Forum Members
Posts: 0, Visits: 166
I've sorted it.  You need to use FamilyName, not DisplayName

  mmdv.Content.Selection.SelectAll();
  mmdv.Content.Selection.SetFontSizeToSelectedInlines(MMFont.PointSize);
  mmdv.Content.Selection.SetFontNameToSelectedInlines(MMFont.FamilyName);
  mmdv.Content.Selection.DeselectAll();

For example, 'Brush Script MT' has a FamilyName 'Brush Script MT' but a DisplayName 'Brush Script MT Italic' and somehow this was stopping the NRichTextView from changing the font.
Thanks
Neil

Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Neil,
We're glad you fixed it. You can also download the latest SP of NOV which features an update the to the font thumbnail combo box with better font measurement. Also the paragraph clipping for certain fonts should be gone. Let us know if you meet any problems or have any questions.


Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search