Closed delphidabbler closed 2 years ago
@PeterPanino - this is still on the todo list!
Think I've worked out how to do this - needs some testing.
I can test it for you.
Cheers @peterpanino
Couldn't sleep last night so ended up browsing source code on my tablet! Think I know what to do now.
The TDetailViewFrame.BuildCSS method in the FrDetailView unit is probably where the font size needs to be set from Preferences.
Need to set font size in the following CSS:
body
table
h1
h2
.active-text h2
.snippet-list .active-text h2
#newtab
Need to give some thought to whether to simply add a constant size for larger fonts (like h1
for e.g.) or whether to scale them up proportionately).
Not sleeping again!
Here's some suggested code for TDetailViewFrame.BuildCSS that might do the job.
Add new ContentFont
object:
var
ContentFont: TFont;
...
begin
ContentFont := nil;
CSSFont := TFont.Create;
try
ContentFont := TFont.Create;
TFontHelper.SetContentFont(ContentFont);
ContentFont.Size := Preferences.xxxxx;
...
finally
ContentFont.Free;
...
end;
end;
Then whenever we have the statement
TFontHelper.SetContentFont(CSSFont);
Replace it with
CSSFont.Assign(ContentFont);
And if we decide to scale heading fonts, use something like this:
var
FontScaleFactor: Single;
...
begin
...
FontScaleFactor := 1.0 / ContentFont.Size;
...
CSSFont.Size := CSSFont.Size + Max(
Round(CSSFont.Size * FontScaleFactor * Increment),
Increment
);
...
end;
Where
FontScaleFactor
is the amount we increase a font size by to get proportionally the same growth as adding 1 to the default content font size.Increment
is the number of point sizes the content font size was originally increased by.The above worked quite well, but I needed to deal with the <code>
tags generated by the REML <mono>
tags. They were overriding the body font size. Aargh!
@PeterPanino I think I've done it, and would be grateful if you could test.
I've attached a copy of a special, portable, 4.19.0 build with an extra entry on Preferences | Display page for the "detail pane" font. That changes all the font sizes in the detail pane except for the source code - that can already be changed on the Syntax Highlighter page. It's not very elegant, but the preferences dialogue resisted my attempts to move the source code font sizing code to a different page - it was going to get messy.
Download CodeSnip-Portable-Special-Build-419.zip
I've sent the portable version, so you can just extract and run it to test it without it affecting your existing installation in any way. I've included a copy of the Code Snippets Database, along with a special custom test snippet (see the _TEST
category) that contains all possible formatting options that can appear on the detail pane. The downside is that the portable version won't display your own snippets (but you can import them if you feel the need - see this FAQ).
BTW I haven't customised any fonts in the attached version - I'll leave that for you to try to ensure it works "out of the box".
Anyhow, if you find it's suitable I can release the official v4.20.0 version in a couple of days.
I'm afraid there's nothing I can do to resize the menu, status bar or dialogue boxes - I made them scalable originally but it was such a mess I turned it all off again!
I've not updated the help file yet.
Thx for offering to help.
BTW2: If you want to poke around, the font info is stored in
AppData\User.config
under the[Prefs:Display]
section in theOverviewFontSize
andDetailFontSize
keys (they'll not be present until you have run the program at least once). The source code font size is in[Prefs:Hiliter]
under theFontSize
key.For completeness, the Code Snippets database files are in
AppData\CSDB
and custom snippets are inAppData\UserDB
. Last but not least, favourites are recorded inAppData\Favourites
. The emptyUserData
directory is there for the user's own files - eg export files, backup files.
No response received. Assuming all is OK.
Following implementation of customisable font size for overview pane tree view (see issue #7), it remains 5o allow for customisation of the font size for detail pane, as was suggested by the IP of issue #7.