Hi Monks-
++mikepol for asking
++zentara for his answer (and all his much appreciated pTk expertise over the years)
I know this is an old thread, but just had a similar question and could not find a suitable answer anywhere (on-site or off-site).
After banging my head against things for long enough, I came up with this solution. Hopefully, it will help others in the future.
-Craig
use strict;
use warnings;
use Tk;
use Tk::Text;
use Tk::Font;
use Data::Dumper;
# Create pTk text window...
my $mw = MainWindow->new(-title => 'Text Font');
my $txt = $mw->Scrolled('Text')->pack(-fill => 'x', -side => 'left');
# Get Current font...
my $currfont = $txt->cget(-font);
# Create new font by cloning & modifying current font...
my $boldfont= $currfont->Clone(-weight=>'bold');
# configure new tag ('bold') causing tagged characters to use the new
+bold font...
$txt->tagConfigure('bold', -font => $boldfont);
# Insert some text that is not tagged as bold...
$txt->insert('end', "========================\n");
$txt->insert('end', "Default font requested:\n" . Dumper($currfont));
$txt->insert('end', "\nDefault font chosen:\n" . Dumper($currfont->act
+ual));
# Insert some text that is tagged as bold...
$txt->insert('end', "========================\n");
$txt->insert('end', "Bold font requested:\n" . Dumper($boldfont), ['bo
+ld']);
$txt->insert('end', "\nBold font chosen:\n" . Dumper($boldfont->actual
+), ['bold']);
MainLoop;