GTK: how to get width and height of GTK_ICON_SIZE_BUTTON etc? - gtk

I need to add my own images into GTK Icon Theme, so i need to somehow figure the size in pixels GTK uses to display icons of different predefined sizes: GTK_ICON_SIZE_BUTTON, GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_DIALOG etc. GTK manual states that sizes are available as value of gtk-icon-sizes property of GtkSettings object. I have executed following code on latest ubuntu:
#!/usr/bin/env python
import gtk; print(gtk.settings_get_default().get_property('gtk-icon-sizes'))
But the output is very short:
'panel-menu=22,22;gtk-button=16,16'
Where can i find rest of the sizes, for example for GTK_ICON_SIZE_DIALOG or GTK_ICON_SIZE_LARGE_TOOLBAR?

GTK resizes the icons to whatever size they need to be. According to the Icon Theme Specification, you should make at least one 48x48 icon, and optionally a scalable SVG icon. That is enough to be able to display any of those sizes.
The Tango Icon Theme Guidelines recommend some supplementary sizes that you can make, in order to minimize how often the icon has to be resized internally by GTK.

Just add your images to the icon list with gtk_icon_theme_add_builtin_icon, and then use them as named icons.
An example in Vala:
Gdk.Pixbuf pixbuf;
pixbuf = new Gdk.Pixbuf.from_file_at_size(Path.build_filename(AutovalaPluginConstants.DATADIR,"valaplugin","application.svg"),-1,-1);
Gtk.IconTheme.add_builtin_icon("autovala-plugin-executable",-1,pixbuf);

Related

How to add text label to a MapMarker? MapViewPins have poor perfomance apparently

I'd like to add custom markers with text labels on my map. I can use MapViewPins for this, but they "tremble" when map is being moved. Even one MapViewPin behaves like this in official Here example, so it is probably not an optimization issue.
When i load PNG image and use it as a MapMarker, it works perfectly. But i don't know how to add text to a marker.
I am using Here SDK for Flutter (Navigate Edition) 4.12.4.0 with Flutter 3.3.2
GIF below is an example. Cyan circles are MapMarkers, markers with icons and label are MapViewPins. Is there any solution to this problem?
Unfortunately, the MapViewPins, being widgets embedded in the MapView surface, need to be relocated to the fixed coordinates every time the map is interacted with by gestures, which is why you notice this "strange" behavior.
However, what you mention about using MapMarkers would be the best solution but in this case instead of using PNG files, you could use SVG files in which you enter the text you want to display.
There is currently no other way available to do what you mention using the HERE SDK (Navigate Edition).
Here is a link to our most up-to-date HERE SDK (Navigate Edition) documentation: https://developer.here.com/documentation/flutter-sdk-navigate/dev_guide/index.html

Setting Button's Size in TinyMCE 4

I'm new with TinyMCE and trying to set the size of some of the buttons in the editor to small and some others' to medium, in TinyMCE 4.
I know about this property toolbar_items_size but this sets all the button's size small or medium. Instead, I'm trying to set the size property of the buttons in editor.buttons[] manually after the buttons get registered with the editor but before the theme gets initialized since the theme uses Factory.create() to create buttons & that sets class btn-<size> to the button, which sets its size.
I've looked into TinyMCE's code too but have not able to figure out a way to do so. Also, I've observed that all the editor's events get fired after the theme gets initialized, like BeforeSetContent,..etc.
I'm using modern theme.
Is there some way to achieve this?
Thanks.
TinyMCE simply does not support what you are trying to do - the buttons on the toolbar(s) are a uniform size. You can pick that uniform size (as you reference) but you can't mix buttons of different sizes on the toolbar.

Custom fonts in Github's markdown (like README.md)?

Is it possible to use custom fonts with github's markdown? I'm currently loading an image as a logo, yet rendering a font would be faster and nicer.
rendering a font would be faster and nicer.
Yes, except you wound not use any (multiple) colors in said "icon as a font".
See "GitHub redesigns its icons using a custom font"
You can, of course, take a monotone font-rendered icon and set its colour to, for example, red or blue, but that changes the entire icon; you can’t have different parts of the icon use different colours, or use shading
(example of CSS effects for Icon Font here, from the Trello article)
But, as far as I can see (Markdown Cheatsheet, and Markdown Help), no, you cannot have a custom font.
You can have a custom font, just generate it with https://github.com/crocodilejs/custom-fonts-in-emails and then you can just put the image/upload it to GitHub readme.

iPhone iOS5 How can I present a font type, size, color and alignment widget to the user?

I have a few UITextFields and I would like the user to be able to change the font's appearance within those fields.
Right now I have a UIToolbar with 5 buttons used for font controls. One for font name, one for size, one for color and one for alignment.
To change font, I display a picker with the fonts family names, letting the user pick default font for that family.
For the font color, I display another toolbar with a font size slider
For font color, I display an open source color picker
For font alignment, I display a button that cycles through the left/center/right alignment.
Finally there's a close button that hides the toolbar.
Currently all of my code is in one controller, but I would like to have it refactored into a separate, reusable class.
Since I'll be rewriting code, are there any open source font controls like I'm describing above? Maybe I can just plug in something that's already made into my project?
Thank you!
It wouldn't be very hard at all. Instead of pickers use a scroll view with buttons and labels above them using the font. As for size you could do the same!
This would be easy in Xcode 4, not so sure in 3.X.X
I found that the attributed string example by apple does have a table view-like font controller that includes a preview of what fonts look like. I think extending that controller may be the easiest thing to do:
http://developer.apple.com/library/ios/#samplecode/CoreTextPageViewer/Introduction/Intro.html

How do I change gnome icon per application?

I want to change icons to something different per application. I want to change only nm-applet (gnomes network manager applet) and my volume applet to something different than the icon set. How can I do this?
You can make your own icon theme with just those two icons in it. The other icons will be taken from the default 'hicolor' theme.