I am trying to have a popupmenu containing a list of fonts ( only mac project )
when the user opens the popupmenu, all the fonts names are show, but rendered 
with using the font itself, to have a preview of the font

so I use the NSFontManagerMBS to have the font list and cycle on them

fontManager = new NSFontManagerMBS
for each fontFamilyName as string in fontFamilyNames…

for very font I create a font object:
n = NSFontMBS.fontWithName(fontFamilyName, 14)

I create also a NSMenuItemMBS, and an NSAttributedStringMBS with the font name 
as string and the font itself as attribute

m = new NSMenuItemMBS
m.CreateMenuItem(fontFamilyName)
NSAttributes = New Dictionary
NSAttributes.value(NSAttributedStringMBS.NSFontAttributeName) = n
NSStringaAttributi = 
NSAttributedStringMBS.attributedStringWithString(FintNameString,NSAttributes)
m.attributedTitle = NSStringaAttributi

then I add the NSMenuItemMBS

p.menu.addItem m

this works fine, and I have a popup with all the font families listed, each one 
rendered with the correct font, but the result is pretty ugly, because each 
font renders differently in size and space above and below, resulting in a list 
of items with different heights and position of the string relative to the 
menuitem rect.

any suggestions on how to render the fonts with similar heights, and have 
menuitems of the same height with the font string centered?

I have thinked also to create images and assign them to the NSMenuItemMBS, but 
again, how to have it filling the image correctlìy and vertically centered?

hope the question is clear,

thanks for tour help

     Giulio


- - - - - - - - - - - - - - - - - - - - - - -
BitBazar Srl
Via Andrea Doria, 57
00192 Roma
tel +39 0639737052
tel +39 0639725787
fax +39 0691659229
http://www.cantoberon.it <http://www.cantoberon.it/>
- - - - - - - - - - - - - - - - - - - - - - -





 <http://www.bitbazar.com/>
> Il giorno 18/dic/2014, alle ore 13:36, Hans van Schaick - AST Software 
> <hvanscha...@ast-software.nl> ha scritto:
> 
> Append, EndPage followed by MovePage works for me.
> 
> Thanks,
> 
> Hans
>> Op 12 dec. 2014, om 16:52 heeft Christian Schmitz 
>> <supp...@monkeybreadsoftware.de> het volgende geschreven:
>> 
>> 
>>> Am 12.12.2014 um 15:25 schrieb Hans van Schaick - AST Software 
>>> <hvanscha...@ast-software.nl>:
>>> 
>>> Hi,
>>> 
>>> I am creating pdf documents successfully.
>>> Now I want to insert a table of contents after processing all data in the 
>>> newly created file…
>>> Is there an way to insert a page? I can only find addPage which does what 
>>> it is supposed to do, adding pages at the end…
>> 
>> Well, you can append one and use ExchangePages function to swap them.
>> Or MovePage to move one.
>> Or leave empty pages and use EditPage to edit them later.
>> 
>> Greetings
>> Christian
>> 
>> -- 
>> Read our blog about news on our plugins:
>> 
>> http://www.mbsplugins.de/
>> 
>> _______________________________________________
>> Mbsplugins_monkeybreadsoftware.info mailing list
>> mbsplugins@monkeybreadsoftware.info
>> https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info
> 
> _______________________________________________
> Mbsplugins_monkeybreadsoftware.info mailing list
> mbsplugins@monkeybreadsoftware.info
> https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
mbsplugins@monkeybreadsoftware.info
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to