Sublime Forum

Is there a way I can set the font of the popupcss

#1

Hi,
Is there a way I can set the font of the popupcss.

Thanks

1 Like

#2

default popups

The stylesheet(s) of popups, created using the default view.show_popup() method can be modified using the color scheme (*.tmTheme) file.

The following code snippet shows the popupCss key all the CSS style definitions need to be placed to. This key can define default styles which apply to each popup dialog (if not overridden anyhow) and per suggestion of @wbond each popup dialog may define an unique id to be addressed separately. To address the Definitions popup, you may use #show-definitions selector.

<plist version="1.0">
<dict>
	...
	<key>settings</key>
	<array>
		<dict>
			<key>settings</key>
			<dict>
				...
				<key>popupCss</key>
				<string>
					#show-definitions a {
						text-decoration: none;
						font-family: Consolas;
					}
				</string>
				...
			</dict>
		</dict>
	</array>
	...
</dict>
</plist>

mdpopups

Popups created with mdpopups normally don’t use an id to be identified but a wrapper-class. In such cases you need to add a selector like .git-gutter a { ... } to your color scheme to modify the style.

In Packages/User/mdpopups.css you can modifiy global styles used by mdpopups.

Some packages such as GitGutter even allow to add a package specific stylesheet file (e.g.: gitgutter_popup.css) to a package or User directory to modify the style.

mdpopups merges all these sources to one stylesheet in the end. Didn’t look for the priority order, yet.

3 Likes

#3

Thanks for the Tip. I did the above and it did work with Consolas , but it did not work with Operator Mono.
P.S : I am using Operator Mono as the default font for my editor.

Thanks once again.

0 Likes

#4

Operator Mono has an atypical set of face names and weights. Try Operator Mono Book and see if that works. Builds 3127 and newer have improved font selection, but 3126 will have trouble picking up certain weights of certain fonts.

1 Like

#5

I did that , but alas, it did not work. [quote=“wbond, post:4, topic:28997”]
Builds 3127 and newer have improved font selection, but 3126 will have trouble picking up certain weights of certain fonts
[/quote]

I am on the latest Dev Build (3135) on Windows 10 OS

0 Likes

#6

It does seem the font selection for the directwrite engine we use with minihtml is having trouble with Operator Mono. It works when I change to "font_options": ["gdi"] in the settings. I’ll look into this for the next build.

1 Like

#7

I tried with Courier, Courier New, Verdana and Arial when I created my reply without luck. I guess minihtml has some more serious issues with selecting fonts.

0 Likes

#8

I realized that if I put the font name withing double quotes, I can use operator Mono Font. I guess when the name contains spaces, it has to be in quotes???

Thanks for the help though.
Much appreciated…

0 Likes

#9

Before build 3138, yes. Build 3138 (and newer) supports unquoted font names, and have improved Windows font selection with popupCss for fonts with weights other than Regular and Bold.

0 Likes