-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plain fonts #2411
Merged
Merged
Plain fonts #2411
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
bb30324
New Definition class FontDef for font selecting commands defined by \…
brucemiller 71218a7
Rename parameter type FontToken to FontDef for cs explicitly defined …
brucemiller 1badc03
Update \meaning to recognize new FontDef font commands
brucemiller 35c2a2e
Update \the to recognize FontDef commands defined by \font and proces…
brucemiller 6f7f868
Moved decodeMathChar to Package.pm, updating it to more correctly dec…
brucemiller b27e41a
Note that \mit doesn't REQUIRE math, but ony has effect in math (sets…
brucemiller 91ef537
Consistent use of font decoding makes apparent misuse of T_OTHER when…
brucemiller 73fe017
Fix mangled renesting of if/else
brucemiller e9bf750
\cal also does not require math and does nothing in text
brucemiller c764042
Add test case for plain style font manipulations
brucemiller f6afd64
Improve decoding of font filenames into family/series/shape and IMPOR…
brucemiller af96721
Update FontMap to provide options for alphanumerics to remain ASCII i…
brucemiller 8d586d5
Make FontDecode in math keep alphanumerics in math as ASCII w/font ch…
brucemiller 3f6ab14
Update all callers of FontDecode
brucemiller 1a27ba6
Make \cal return a Box so that it can revert
brucemiller 6317280
Enhance and correct plain fonts test cases
brucemiller 2a0bd12
Code cleanup suggested by D.Ginev
brucemiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# /=====================================================================\ # | ||
# | LaTeXML::Core::Definition::FontDef | # | ||
# | Representation of definitions of Fonts | # | ||
# |=====================================================================| # | ||
# | Part of LaTeXML: | # | ||
# | Public domain software, produced as part of work done by the | # | ||
# | United States Government & not subject to copyright in the US. | # | ||
# |---------------------------------------------------------------------| # | ||
# | Bruce Miller <bruce.miller@nist.gov> #_# | # | ||
# | http://dlmf.nist.gov/LaTeXML/ (o o) | # | ||
# \=========================================================ooo==U==ooo=/ # | ||
package LaTeXML::Core::Definition::FontDef; | ||
use strict; | ||
use warnings; | ||
use LaTeXML::Global; | ||
use LaTeXML::Common::Object; | ||
use LaTeXML::Common::Error; | ||
use LaTeXML::Core::Token; | ||
use LaTeXML::Core::Tokens; | ||
use LaTeXML::Core::Box; | ||
use base qw(LaTeXML::Core::Definition::Primitive); | ||
|
||
# A CharDef is a specialized register; | ||
# You can't assign it; when you invoke the control sequence, it returns | ||
# the result of evaluating the character (more like a regular primitive). | ||
# When $mathglyph is provided, it is the unicode corresponding to the \mathchar of $value | ||
sub new { | ||
my ($class, $cs, $fontid, %traits) = @_; | ||
return bless { cs => $cs, parameters => undef, | ||
fontID => $fontid, | ||
locator => $STATE->getStomach->getGullet->getMouth->getLocator, | ||
%traits }, $class; } | ||
|
||
# Return the "font info" associated with the (TeX) font that this command selects (See \font) | ||
sub isFontDef { | ||
my ($self) = @_; | ||
return $STATE->lookupValue($$self{fontID}); } | ||
|
||
sub invoke { | ||
my ($self, $stomach) = @_; | ||
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'); | ||
$STATE->assignValue(font => $STATE->lookupValue('font')->merge(%$fontinfo), 'local'); | ||
} | ||
return Box(undef, undef, undef, $$self{cs}); } | ||
|
||
#=============================================================================== | ||
1; | ||
|
||
__END__ | ||
|
||
=pod | ||
|
||
=head1 NAME | ||
|
||
C<LaTeXML::Core::Definition::FontDef> - Control sequence definitions for font symbols defined by \font. | ||
|
||
=head1 DESCRIPTION | ||
|
||
Representation for control sequences defined by \font. | ||
It extends L<LaTeXML::Core::Definition::Primitive>. | ||
|
||
=head1 AUTHOR | ||
|
||
Bruce Miller <bruce.miller@nist.gov> | ||
|
||
=head1 COPYRIGHT | ||
|
||
Public domain software, produced as part of work done by the | ||
United States Government & not subject to copyright in the US. | ||
|
||
=cut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use
$current
here, or better yet keep as-is and remove the outer lookup (since it's only needed if$fontinfo
has a value).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Thanks!