<p>So that is why I was never able to specify in Geany, in the font dialog, the style (bold/italic etc) for a font family. Makes sense.</p>
<p>Yesterday I decided to  adventure in the world of programming :) , and after 2 days of staring on GTK documentation, put together some <code>coding ideas</code> for all this filtering.<br>
<em>Disclaimer: I'm not a programmer, I only have rudimentary C knowledge, and never ever before had to deal with Gtk or anything like that... So most likely much of the "code" below is simply wrong, but maybe somehow it will still help a tiny bit the person who will actually implement this filtering.</em></p>
<p>Any feedback welcome!</p>
<p>So, I just assumed a 2 check-buttons style for selecting monospace vs proportional, without bothering with further styling, or correct placing within the Geany overall code (for which I don't have a clue).</p>
<p>On terminology and labels choice:<br>
Different pages disagree on whether "duospaced" fonts are monospace or not; so perhaps "fixed-width" vs "variable-width" is a better option... But that's not so relevant for now.<br>
//<a href="https://developer.gnome.org/pango/stable/pango-Fonts.html#pango-font-family-is-monospace" rel="nofollow">https://developer.gnome.org/pango/stable/pango-Fonts.html#pango-font-family-is-monospace</a><br>
// <a href="https://en.wikipedia.org/wiki/Monospaced_font" rel="nofollow">https://en.wikipedia.org/wiki/Monospaced_font</a><br>
// <a href="https://en.wikipedia.org/wiki/Typeface#Proportion" rel="nofollow">https://en.wikipedia.org/wiki/Typeface#Proportion</a><br>
//<a href="https://en.wikipedia.org/wiki/Duospaced_font" rel="nofollow">https://en.wikipedia.org/wiki/Duospaced_font</a></p>
<p>To filter out unused faces ("styles" in my Geany font chooser) for a family:<br>
a tricky part may be that some font families don't contain "normal" faces, but say only  Bold  faces ; (selecting such font actually makes the text bold in Geany; example in my installation: <code>Adobe Caslo Pro Bold</code> only has 2 named styles: Bold and Bold Italic ; or <code>Aharoni</code> and many others  ). So they cannot be filtered out by asking the style and weight of a face to be specifically "normal". (see below <a href="https://developer.gnome.org/pango/stable/pango-Fonts.html#PangoFontDescription-struct" rel="nofollow">this</a></p>
<p>Maybe one can instead make the filter allow a font only if it is the first encountered face of a family. This assumes that the [gtk_font_chooser_set_filter_func] (<a href="https://developer.gnome.org/gtk3/stable/GtkFontChooser.html#gtk-font-chooser-set-filter-func" rel="nofollow">https://developer.gnome.org/gtk3/stable/GtkFontChooser.html#gtk-font-chooser-set-filter-func</a>)  runs over some list of all fonts (all faces of all families, for a given platform), and that list is sorted by family, and also all fonts of a family are sorted so that a font with "normal" style/weight (IF any present for the particular family) appears before fonts with bold/slanted etc style/weight.</p>
<p>Maybe it's a naive assumption, but seems plausible. Anyway, that is what I have assumed bellow...</p>
<p>I have included the filtering out of the unneeded faces/styles in the same function that filters based on checking-state of the buttons. I'm aware this is very inefficient, because this filtering will be done everytime the fontChooser dialog is launched and the checkbuttons activated -- instead of a single filtering of the uneeded styles once and for all, for a given Geany installation, and save the info in a local file, and to be consulted when Fontchooser dialog starts.<br>
But I've no idea, for now, how to do that . (Maybe related to <a href="https://developer.gnome.org/pango/stable/pango-Fonts.html" rel="nofollow">PangoFontMap or PangoFontSet</a> )<br>
And anyway, this is just some ideas...</p>
<p>Low and behold, <code>coding horror</code> follows :)</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/1928#issuecomment-416013558">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ-I9wirdOPhVCfZmwB2-2rrG74VBks5uUibLgaJpZM4WGvIU">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABDrJ1KewO4W8UUMlYoDw5dScdduCcuOks5uUibLgaJpZM4WGvIU.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany","title":"geany/geany","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany"}},"updates":{"snippets":[{"icon":"PERSON","message":"@VictorelPetrovich in #1928: So that is why I was never able to specify in Geany, in the font dialog, the style (bold/italic etc) for a font family. Makes sense.\r\n\r\nYesterday I decided to  adventure in the world of programming :) , and after 2 days of staring on GTK documentation, put together some `coding ideas` for all this filtering. \r\n_Disclaimer: I'm not a programmer, I only have rudimentary C knowledge, and never ever before had to deal with Gtk or anything like that... So most likely much of the \"code\" below is simply wrong, but maybe somehow it will still help a tiny bit the person who will actually implement this filtering._ \r\n\r\nAny feedback welcome!\r\n\r\nSo, I just assumed a 2 check-buttons style for selecting monospace vs proportional, without bothering with further styling, or correct placing within the Geany overall code (for which I don't have a clue).\r\n\r\nOn terminology and labels choice:\r\nDifferent pages disagree on whether \"duospaced\" fonts are monospace or not; so perhaps \"fixed-width\" vs \"variable-width\" is a better option... But that's not so relevant for now.\r\n//https://developer.gnome.org/pango/stable/pango-Fonts.html#pango-font-family-is-monospace\r\n// https://en.wikipedia.org/wiki/Monospaced_font\r\n// https://en.wikipedia.org/wiki/Typeface#Proportion\r\n//https://en.wikipedia.org/wiki/Duospaced_font\r\n\r\n To filter out unused faces (\"styles\" in my Geany font chooser) for a family:\r\n a tricky part may be that some font families don't contain \"normal\" faces, but say only  Bold  faces ; (selecting such font actually makes the text bold in Geany; example in my installation: `Adobe Caslo Pro Bold` only has 2 named styles: Bold and Bold Italic ; or `Aharoni` and many others  ). So they cannot be filtered out by asking the style and weight of a face to be specifically \"normal\". (see below [this](https://developer.gnome.org/pango/stable/pango-Fonts.html#PangoFontDescription-struct) \r\n\r\nMaybe one can instead make the filter allow a font only if it is the first encountered face of a family. This assumes that the [gtk_font_chooser_set_filter_func] (https://developer.gnome.org/gtk3/stable/GtkFontChooser.html#gtk-font-chooser-set-filter-func)  runs over some list of all fonts (all faces of all families, for a given platform), and that list is sorted by family, and also all fonts of a family are sorted so that a font with \"normal\" style/weight (IF any present for the particular family) appears before fonts with bold/slanted etc style/weight. \r\n\r\nMaybe it's a naive assumption, but seems plausible. Anyway, that is what I have assumed bellow...\r\n\r\nI have included the filtering out of the unneeded faces/styles in the same function that filters based on checking-state of the buttons. I'm aware this is very inefficient, because this filtering will be done everytime the fontChooser dialog is launched and the checkbuttons activated -- instead of a single filtering of the uneeded styles once and for all, for a given Geany installation, and save the info in a local file, and to be consulted when Fontchooser dialog starts.\r\nBut I've no idea, for now, how to do that . (Maybe related to [PangoFontMap or PangoFontSet](https://developer.gnome.org/pango/stable/pango-Fonts.html) )\r\nAnd anyway, this is just some ideas...\r\n\r\nLow and behold, `coding horror` follows :)\r\n"}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/1928#issuecomment-416013558"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/issues/1928#issuecomment-416013558",
"url": "https://github.com/geany/geany/issues/1928#issuecomment-416013558",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "Re: [geany/geany] choose font: classify families into monospace/proportional (#1928)",
"sections": [
{
"text": "",
"activityTitle": "**VictorelPetrovich**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@VictorelPetrovich",
"facts": [

]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"geany/geany\",\n\"issueId\": 1928,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/geany/geany/issues/1928#issuecomment-416013558"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 370864660\n}"
}
],
"themeColor": "26292E"
}
]</script>