Skip to content

Commit

Permalink
Code cleanup suggested by D.Ginev
Browse files Browse the repository at this point in the history
  • Loading branch information
brucemiller committed Sep 18, 2024
1 parent 6317280 commit 2a0bd12
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion lib/LaTeXML/Core/Definition/FontDef.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ sub isFontDef {

sub invoke {
my ($self, $stomach) = @_;
my $current = $STATE->lookupValue('font');
if (my $fontinfo = $STATE->lookupValue($$self{fontID})) {
# Temporary hack for \the\font; remember the last font def executed
$STATE->assignValue(current_FontDef => $$self{cs}, 'local');
Expand Down
2 changes: 1 addition & 1 deletion lib/LaTeXML/Engine/TeX_Debugging.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ DefMacro('\meaning Token', sub {
$type =~ s/^LaTeXML:://;
# Pre-step: We can't extract the bodies of definitions which are defined via Perl subroutines.
# So do the next best thing -- represent them as their tokens.
if ($type =~ /(fontdef)$/i) {
if ($type =~ /fontdef$/i) {
if (my $fontinfo = $definition->isFontDef) {
$meaning = 'select font ' . ($$fontinfo{name} || 'fontname');
$meaning .= ' at ' . $$fontinfo{at} if $$fontinfo{at};
Expand Down
9 changes: 4 additions & 5 deletions lib/LaTeXML/Engine/TeX_Fonts.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ use LaTeXML::Package;
# defined by \font, OR \textfont, \scriptfont,\scriptscriptfont, or even \font itself
# Actually returns the fontinfo (hash) associated with the font.
DefParameterType('FontDef', sub {
my ($gullet) = @_;
my $readtoken = $gullet->readToken;
my $token = $readtoken;
my ($gullet) = @_;
my $token = $gullet->readToken;
# Or use LookupRegister???
if ($token->toString =~ /^\\(text|script|scriptscript)font$/) {
if ($token && ($token->toString =~ /^\\(text|script|scriptscript)font$/)) {
my $type = $1;
if (my $fam = $gullet->readNumber) {
$token = LookupValue($type . 'font_' . $fam->valueOf); } }
# Need the cs that selected the current font! (which we don't have!)
if ($token->toString eq '\font') { # Current font ??? Return last pure TeX font used (HACK)
if ($token && ($token->toString eq '\font')) { # Current font ??? Return last pure TeX font used (HACK)
$token = LookupValue('current_FontDef') || T_CS('\tenrm'); }
if (my $defn = $token && $STATE->lookupDefinition($token)) {
return $defn->isFontDef; }
Expand Down

0 comments on commit 2a0bd12

Please sign in to comment.