How to replace a letter?
Clash Royale CLAN TAG#URR8PPP
up vote
8
down vote
favorite
When I use font package FiraSans
I enter "g", get
But actually I want to get
I don't quite understand that FiraSans font has two g forms, but they do exist in "*.otf"
I checked the description and ".sty" file of the package, only found the command to control the numeric style.
If you can not affect the Italian font, then it is better.
fonts
 |Â
show 3 more comments
up vote
8
down vote
favorite
When I use font package FiraSans
I enter "g", get
But actually I want to get
I don't quite understand that FiraSans font has two g forms, but they do exist in "*.otf"
I checked the description and ".sty" file of the package, only found the command to control the numeric style.
If you can not affect the Italian font, then it is better.
fonts
Do you use XeLaTeX or LuaLaTeX with the.otf
fonts or pdfLaTeX with Type 1 fonts?
â moewe
Aug 25 at 16:13
6
If you switch to FiraGO (bboxtype.com), the successor to Fira Sans 4.3,ss05
controls âÂÂgâ and only âÂÂgâÂÂ, whereas in Fira Sansss04
controls both âÂÂgâ and âÂÂaâÂÂ.
â Thérèse
Aug 25 at 16:54
@Thérèse Are the stylistic sets and alternatives of the font families documented anywhere, or do we just have to look it up in a program like FontForge?
â Davislor
Aug 25 at 17:59
@Davislor Some designers and foundries provide documentation, and others donâÂÂt. FiraGo comes with several PDF files, and those called âÂÂTechnical_Report*.pdfâ dcoument the features.
â Thérèse
Aug 25 at 18:03
@Thérèse Ah! I did look through that document, but I didn't see it until I searched. According to pages 37âÂÂ38, Stylistic Set 5 ought to work in Fira Sans as well.
â Davislor
Aug 25 at 18:10
 |Â
show 3 more comments
up vote
8
down vote
favorite
up vote
8
down vote
favorite
When I use font package FiraSans
I enter "g", get
But actually I want to get
I don't quite understand that FiraSans font has two g forms, but they do exist in "*.otf"
I checked the description and ".sty" file of the package, only found the command to control the numeric style.
If you can not affect the Italian font, then it is better.
fonts
When I use font package FiraSans
I enter "g", get
But actually I want to get
I don't quite understand that FiraSans font has two g forms, but they do exist in "*.otf"
I checked the description and ".sty" file of the package, only found the command to control the numeric style.
If you can not affect the Italian font, then it is better.
fonts
asked Aug 25 at 16:00
poorich
1728
1728
Do you use XeLaTeX or LuaLaTeX with the.otf
fonts or pdfLaTeX with Type 1 fonts?
â moewe
Aug 25 at 16:13
6
If you switch to FiraGO (bboxtype.com), the successor to Fira Sans 4.3,ss05
controls âÂÂgâ and only âÂÂgâÂÂ, whereas in Fira Sansss04
controls both âÂÂgâ and âÂÂaâÂÂ.
â Thérèse
Aug 25 at 16:54
@Thérèse Are the stylistic sets and alternatives of the font families documented anywhere, or do we just have to look it up in a program like FontForge?
â Davislor
Aug 25 at 17:59
@Davislor Some designers and foundries provide documentation, and others donâÂÂt. FiraGo comes with several PDF files, and those called âÂÂTechnical_Report*.pdfâ dcoument the features.
â Thérèse
Aug 25 at 18:03
@Thérèse Ah! I did look through that document, but I didn't see it until I searched. According to pages 37âÂÂ38, Stylistic Set 5 ought to work in Fira Sans as well.
â Davislor
Aug 25 at 18:10
 |Â
show 3 more comments
Do you use XeLaTeX or LuaLaTeX with the.otf
fonts or pdfLaTeX with Type 1 fonts?
â moewe
Aug 25 at 16:13
6
If you switch to FiraGO (bboxtype.com), the successor to Fira Sans 4.3,ss05
controls âÂÂgâ and only âÂÂgâÂÂ, whereas in Fira Sansss04
controls both âÂÂgâ and âÂÂaâÂÂ.
â Thérèse
Aug 25 at 16:54
@Thérèse Are the stylistic sets and alternatives of the font families documented anywhere, or do we just have to look it up in a program like FontForge?
â Davislor
Aug 25 at 17:59
@Davislor Some designers and foundries provide documentation, and others donâÂÂt. FiraGo comes with several PDF files, and those called âÂÂTechnical_Report*.pdfâ dcoument the features.
â Thérèse
Aug 25 at 18:03
@Thérèse Ah! I did look through that document, but I didn't see it until I searched. According to pages 37âÂÂ38, Stylistic Set 5 ought to work in Fira Sans as well.
â Davislor
Aug 25 at 18:10
Do you use XeLaTeX or LuaLaTeX with the
.otf
fonts or pdfLaTeX with Type 1 fonts?â moewe
Aug 25 at 16:13
Do you use XeLaTeX or LuaLaTeX with the
.otf
fonts or pdfLaTeX with Type 1 fonts?â moewe
Aug 25 at 16:13
6
6
If you switch to FiraGO (bboxtype.com), the successor to Fira Sans 4.3,
ss05
controls âÂÂgâ and only âÂÂgâÂÂ, whereas in Fira Sans ss04
controls both âÂÂgâ and âÂÂaâÂÂ.â Thérèse
Aug 25 at 16:54
If you switch to FiraGO (bboxtype.com), the successor to Fira Sans 4.3,
ss05
controls âÂÂgâ and only âÂÂgâÂÂ, whereas in Fira Sans ss04
controls both âÂÂgâ and âÂÂaâÂÂ.â Thérèse
Aug 25 at 16:54
@Thérèse Are the stylistic sets and alternatives of the font families documented anywhere, or do we just have to look it up in a program like FontForge?
â Davislor
Aug 25 at 17:59
@Thérèse Are the stylistic sets and alternatives of the font families documented anywhere, or do we just have to look it up in a program like FontForge?
â Davislor
Aug 25 at 17:59
@Davislor Some designers and foundries provide documentation, and others donâÂÂt. FiraGo comes with several PDF files, and those called âÂÂTechnical_Report*.pdfâ dcoument the features.
â Thérèse
Aug 25 at 18:03
@Davislor Some designers and foundries provide documentation, and others donâÂÂt. FiraGo comes with several PDF files, and those called âÂÂTechnical_Report*.pdfâ dcoument the features.
â Thérèse
Aug 25 at 18:03
@Thérèse Ah! I did look through that document, but I didn't see it until I searched. According to pages 37âÂÂ38, Stylistic Set 5 ought to work in Fira Sans as well.
â Davislor
Aug 25 at 18:10
@Thérèse Ah! I did look through that document, but I didn't see it until I searched. According to pages 37âÂÂ38, Stylistic Set 5 ought to work in Fira Sans as well.
â Davislor
Aug 25 at 18:10
 |Â
show 3 more comments
3 Answers
3
active
oldest
votes
up vote
7
down vote
accepted
The following workaround enables you to change the letter g without also changing the letter a, in the upright font. First, download the updated version (4.301) of the font files (or at least the ones that are in TEXMF/fonts/opentype/public/fira
into a subdirectory of your project directory, named fonts
.
This version contains the substitution you want as Stylistic Set 5. You can tell fontspec
to look in your projectâÂÂs fonts
directory for Fira Sans and to add this stylistic set on every upright font in the family that it will load in the future.
This will completely remove any ambiguity about which of the several versions of Fira Sans on your hard drive you want to load.
Then, load the firasans
package and get all its interfaces. Or load it yourself by the method of your choice.
documentclass[varwidth, preview]standalone
usepackagefontspec
% Requires version 4.301 of the font files to be stored in a subdirectory
% named fonts
defaultfontfeatures[FiraSans]
UprightFeatures = StylisticSet=5 ,
BoldFeatures = StylisticSet=5 ,
Path = ./fonts/
usepackage[sfdefault]firasans
begindocument
Ziggy eats eggs.
enddocument
If the package maintainer updates the version of the fonts in the TeX Live distribution, this hack will no longer be necessary. As of TeX Live 2018, it is.
Another Approach
The firasans
package is what you were using before, and has a number of options and support for different font weights. Since some commenters requested a solution using only fontspec
, here it is. This defines the de-facto standard LaTeX2e series names, as defined in the second edition of The LaTeX Companion and The LaTeX Font Installation Guide.
This version does not support all the weights of the font family, but it does support all the ones that correspond to LaTeX commands in common use, such as textlf
and sbseries
. For ordinary use, you might prefer to do what the package does and create a font family that selects relatively lighter or darker weights as its regular and bold.
It does define firafamily
for compatibility with firasans
, but doesnâÂÂt declare all the variants that package does.
It is also more future-proof, should the firasans
package ever change (for example, to load Fira Go).
documentclass[varwidth, preview]standalone
usepackagefontspec
% Requires version 4.301 of the font files to be stored in a subdirectory
% named fonts
setsansfontFiraSans[
Ligatures = Common, Discretionary, TeX ,
Numbers = Lining, OldStyle ,
Scale = 1.0 ,
FontFace = uln StylisticSet=5, Font = *-UltraLight,
FontFace = ulit*-UltraLightItalic,
FontFace = eln StylisticSet=5, Font = *-ExtraLight,
FontFace = elit*-ExtraLightItalic,
FontFace = ln StylisticSet=5, Font = *-Light,
FontFace = lit*-LightItalic,
UprightFont = *-Regular ,
UprightFeatures = StylisticSet=5 ,
ItalicFont = *-Italic ,
FontFace = mbn StylisticSet=5, Font = *-Book,
FontFace = mbit*-BookItalic,
FontFace = sbn StylisticSet=5, Font = *-Medium,
FontFace = sbit*-MediumItalic,
FontFace = dbn StylisticSet=5, Font = *-Semibold,
FontFace = dbit*-SemiboldItalic,
BoldFont = *-Bold ,
BoldFeatures = StylisticSet=5 ,
BoldItalicFont = *-BoldItalic ,
FontFace = ebn StylisticSet=5, Font = *-ExtraBold,
FontFace = ebit*-ExtraBoldItalic,
FontFace = ubn StylisticSet=5, Font = *-Heavy,
FontFace = ubit*-HeavyItalic,
Extension = .otf ,
Path = ./fonts/
]
letfirafamilysfdefault
renewcommand*familydefaultfirafamily
% Load other fonts here.
DeclareRobustCommandulseriesfontseriesulselectfont
DeclareTextFontCommandtextululseries
DeclareRobustCommandelseriesfontserieselselectfont
DeclareTextFontCommandtextelelseries
DeclareRobustCommandlfseriesfontserieslselectfont
DeclareTextFontCommandtextlflfseries
DeclareRobustCommandmbseriesfontseriesmbselectfont
DeclareTextFontCommandtextmbmbseries
DeclareRobustCommandsbseriesfontseriessbselectfont
DeclareTextFontCommandtextsbsbseries
DeclareRobustCommanddbseriesfontseriesdbselectfont
DeclareTextFontCommandtextdbdbseries
DeclareRobustCommandebseriesfontseriesebselectfont
DeclareTextFontCommandtextebebseries
DeclareRobustCommandubseriesfontseriesubselectfont
DeclareTextFontCommandtextububseries
newcommandeggsZiggy eats eggs.
begindocument
parbox160pt
textuleggs texteleggs textlfeggs textmdeggs textmbeggs
textsbeggs textdbeggs textbfeggs textebeggs textubeggs
textittextuleggs texteleggs textlfeggs textmdeggs
textmbeggs textsbeggs textdbeggs textbfeggs textebeggs
textubeggs
enddocument
1
tex.stackexchange.com/q/434273 is relevant if youâÂÂre trying to work with newer versions than those in TeX Live.
â Thérèse
Aug 25 at 18:37
@Thérèse Thanks! In practice, I would either stick my own version of the fonts in a project directory and use fontspecâÂÂsPath =
feature to override the (inconsistent) default search paths, or else change the filename, e.g. toFiraSans4.3-Regular.otf
,
â Davislor
Aug 25 at 23:42
What is the purpose of thefirasans
package?
â AndreKR
Aug 26 at 9:52
@AndreKR I wondered that as well. If one is usingfontspec
, why not just go withsetmainfontFiraSans
? Does the package get you anything extra?
â Derek
Aug 26 at 16:37
I added a second solution using onlyfontspec
. (And also fixed a bug with bold text in the first MWE.)
â Davislor
Aug 26 at 20:10
add a comment |Â
up vote
11
down vote
If you are using LuaLaTeX and the OTF version of the fonts you can try
documentclass[a4paper]article
usepackagefontspec
directlua
fonts.handlers.otf.addfeature
name = "galt",
type = "substitution",
data = ["g"] = 0x210A,
setmainfont[RawFeature=+galt]FiraSans
begindocument
gg
emphgg
enddocument
add a comment |Â
up vote
10
down vote
This is easy if you use fontspec
and xelatex
:
documentclassarticle
usepackagefontspec
setmainfont[StylisticSet=4]FiraSans-Medium.otf
begindocument
Ziggy eats eggs.
enddocument
Update:
Thérèse's note raises an excellent point: if you do it this way, you change the look of both "a" and "g". Just FYI.
There is one question: this method has changed the letter a. Can we not change the letter a?
â poorich
Aug 25 at 17:09
As far as I'm aware, specifyingStylisticSet
is all-or-nothing â you can't pick and choose characters. But I'm not 100% sure I'm right about that.
â Derek
Aug 25 at 17:11
2
The solution of @moewe doesnâÂÂt affect the âÂÂaâ â this is one great advantage to luatex.
â Thérèse
Aug 25 at 17:14
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
accepted
The following workaround enables you to change the letter g without also changing the letter a, in the upright font. First, download the updated version (4.301) of the font files (or at least the ones that are in TEXMF/fonts/opentype/public/fira
into a subdirectory of your project directory, named fonts
.
This version contains the substitution you want as Stylistic Set 5. You can tell fontspec
to look in your projectâÂÂs fonts
directory for Fira Sans and to add this stylistic set on every upright font in the family that it will load in the future.
This will completely remove any ambiguity about which of the several versions of Fira Sans on your hard drive you want to load.
Then, load the firasans
package and get all its interfaces. Or load it yourself by the method of your choice.
documentclass[varwidth, preview]standalone
usepackagefontspec
% Requires version 4.301 of the font files to be stored in a subdirectory
% named fonts
defaultfontfeatures[FiraSans]
UprightFeatures = StylisticSet=5 ,
BoldFeatures = StylisticSet=5 ,
Path = ./fonts/
usepackage[sfdefault]firasans
begindocument
Ziggy eats eggs.
enddocument
If the package maintainer updates the version of the fonts in the TeX Live distribution, this hack will no longer be necessary. As of TeX Live 2018, it is.
Another Approach
The firasans
package is what you were using before, and has a number of options and support for different font weights. Since some commenters requested a solution using only fontspec
, here it is. This defines the de-facto standard LaTeX2e series names, as defined in the second edition of The LaTeX Companion and The LaTeX Font Installation Guide.
This version does not support all the weights of the font family, but it does support all the ones that correspond to LaTeX commands in common use, such as textlf
and sbseries
. For ordinary use, you might prefer to do what the package does and create a font family that selects relatively lighter or darker weights as its regular and bold.
It does define firafamily
for compatibility with firasans
, but doesnâÂÂt declare all the variants that package does.
It is also more future-proof, should the firasans
package ever change (for example, to load Fira Go).
documentclass[varwidth, preview]standalone
usepackagefontspec
% Requires version 4.301 of the font files to be stored in a subdirectory
% named fonts
setsansfontFiraSans[
Ligatures = Common, Discretionary, TeX ,
Numbers = Lining, OldStyle ,
Scale = 1.0 ,
FontFace = uln StylisticSet=5, Font = *-UltraLight,
FontFace = ulit*-UltraLightItalic,
FontFace = eln StylisticSet=5, Font = *-ExtraLight,
FontFace = elit*-ExtraLightItalic,
FontFace = ln StylisticSet=5, Font = *-Light,
FontFace = lit*-LightItalic,
UprightFont = *-Regular ,
UprightFeatures = StylisticSet=5 ,
ItalicFont = *-Italic ,
FontFace = mbn StylisticSet=5, Font = *-Book,
FontFace = mbit*-BookItalic,
FontFace = sbn StylisticSet=5, Font = *-Medium,
FontFace = sbit*-MediumItalic,
FontFace = dbn StylisticSet=5, Font = *-Semibold,
FontFace = dbit*-SemiboldItalic,
BoldFont = *-Bold ,
BoldFeatures = StylisticSet=5 ,
BoldItalicFont = *-BoldItalic ,
FontFace = ebn StylisticSet=5, Font = *-ExtraBold,
FontFace = ebit*-ExtraBoldItalic,
FontFace = ubn StylisticSet=5, Font = *-Heavy,
FontFace = ubit*-HeavyItalic,
Extension = .otf ,
Path = ./fonts/
]
letfirafamilysfdefault
renewcommand*familydefaultfirafamily
% Load other fonts here.
DeclareRobustCommandulseriesfontseriesulselectfont
DeclareTextFontCommandtextululseries
DeclareRobustCommandelseriesfontserieselselectfont
DeclareTextFontCommandtextelelseries
DeclareRobustCommandlfseriesfontserieslselectfont
DeclareTextFontCommandtextlflfseries
DeclareRobustCommandmbseriesfontseriesmbselectfont
DeclareTextFontCommandtextmbmbseries
DeclareRobustCommandsbseriesfontseriessbselectfont
DeclareTextFontCommandtextsbsbseries
DeclareRobustCommanddbseriesfontseriesdbselectfont
DeclareTextFontCommandtextdbdbseries
DeclareRobustCommandebseriesfontseriesebselectfont
DeclareTextFontCommandtextebebseries
DeclareRobustCommandubseriesfontseriesubselectfont
DeclareTextFontCommandtextububseries
newcommandeggsZiggy eats eggs.
begindocument
parbox160pt
textuleggs texteleggs textlfeggs textmdeggs textmbeggs
textsbeggs textdbeggs textbfeggs textebeggs textubeggs
textittextuleggs texteleggs textlfeggs textmdeggs
textmbeggs textsbeggs textdbeggs textbfeggs textebeggs
textubeggs
enddocument
1
tex.stackexchange.com/q/434273 is relevant if youâÂÂre trying to work with newer versions than those in TeX Live.
â Thérèse
Aug 25 at 18:37
@Thérèse Thanks! In practice, I would either stick my own version of the fonts in a project directory and use fontspecâÂÂsPath =
feature to override the (inconsistent) default search paths, or else change the filename, e.g. toFiraSans4.3-Regular.otf
,
â Davislor
Aug 25 at 23:42
What is the purpose of thefirasans
package?
â AndreKR
Aug 26 at 9:52
@AndreKR I wondered that as well. If one is usingfontspec
, why not just go withsetmainfontFiraSans
? Does the package get you anything extra?
â Derek
Aug 26 at 16:37
I added a second solution using onlyfontspec
. (And also fixed a bug with bold text in the first MWE.)
â Davislor
Aug 26 at 20:10
add a comment |Â
up vote
7
down vote
accepted
The following workaround enables you to change the letter g without also changing the letter a, in the upright font. First, download the updated version (4.301) of the font files (or at least the ones that are in TEXMF/fonts/opentype/public/fira
into a subdirectory of your project directory, named fonts
.
This version contains the substitution you want as Stylistic Set 5. You can tell fontspec
to look in your projectâÂÂs fonts
directory for Fira Sans and to add this stylistic set on every upright font in the family that it will load in the future.
This will completely remove any ambiguity about which of the several versions of Fira Sans on your hard drive you want to load.
Then, load the firasans
package and get all its interfaces. Or load it yourself by the method of your choice.
documentclass[varwidth, preview]standalone
usepackagefontspec
% Requires version 4.301 of the font files to be stored in a subdirectory
% named fonts
defaultfontfeatures[FiraSans]
UprightFeatures = StylisticSet=5 ,
BoldFeatures = StylisticSet=5 ,
Path = ./fonts/
usepackage[sfdefault]firasans
begindocument
Ziggy eats eggs.
enddocument
If the package maintainer updates the version of the fonts in the TeX Live distribution, this hack will no longer be necessary. As of TeX Live 2018, it is.
Another Approach
The firasans
package is what you were using before, and has a number of options and support for different font weights. Since some commenters requested a solution using only fontspec
, here it is. This defines the de-facto standard LaTeX2e series names, as defined in the second edition of The LaTeX Companion and The LaTeX Font Installation Guide.
This version does not support all the weights of the font family, but it does support all the ones that correspond to LaTeX commands in common use, such as textlf
and sbseries
. For ordinary use, you might prefer to do what the package does and create a font family that selects relatively lighter or darker weights as its regular and bold.
It does define firafamily
for compatibility with firasans
, but doesnâÂÂt declare all the variants that package does.
It is also more future-proof, should the firasans
package ever change (for example, to load Fira Go).
documentclass[varwidth, preview]standalone
usepackagefontspec
% Requires version 4.301 of the font files to be stored in a subdirectory
% named fonts
setsansfontFiraSans[
Ligatures = Common, Discretionary, TeX ,
Numbers = Lining, OldStyle ,
Scale = 1.0 ,
FontFace = uln StylisticSet=5, Font = *-UltraLight,
FontFace = ulit*-UltraLightItalic,
FontFace = eln StylisticSet=5, Font = *-ExtraLight,
FontFace = elit*-ExtraLightItalic,
FontFace = ln StylisticSet=5, Font = *-Light,
FontFace = lit*-LightItalic,
UprightFont = *-Regular ,
UprightFeatures = StylisticSet=5 ,
ItalicFont = *-Italic ,
FontFace = mbn StylisticSet=5, Font = *-Book,
FontFace = mbit*-BookItalic,
FontFace = sbn StylisticSet=5, Font = *-Medium,
FontFace = sbit*-MediumItalic,
FontFace = dbn StylisticSet=5, Font = *-Semibold,
FontFace = dbit*-SemiboldItalic,
BoldFont = *-Bold ,
BoldFeatures = StylisticSet=5 ,
BoldItalicFont = *-BoldItalic ,
FontFace = ebn StylisticSet=5, Font = *-ExtraBold,
FontFace = ebit*-ExtraBoldItalic,
FontFace = ubn StylisticSet=5, Font = *-Heavy,
FontFace = ubit*-HeavyItalic,
Extension = .otf ,
Path = ./fonts/
]
letfirafamilysfdefault
renewcommand*familydefaultfirafamily
% Load other fonts here.
DeclareRobustCommandulseriesfontseriesulselectfont
DeclareTextFontCommandtextululseries
DeclareRobustCommandelseriesfontserieselselectfont
DeclareTextFontCommandtextelelseries
DeclareRobustCommandlfseriesfontserieslselectfont
DeclareTextFontCommandtextlflfseries
DeclareRobustCommandmbseriesfontseriesmbselectfont
DeclareTextFontCommandtextmbmbseries
DeclareRobustCommandsbseriesfontseriessbselectfont
DeclareTextFontCommandtextsbsbseries
DeclareRobustCommanddbseriesfontseriesdbselectfont
DeclareTextFontCommandtextdbdbseries
DeclareRobustCommandebseriesfontseriesebselectfont
DeclareTextFontCommandtextebebseries
DeclareRobustCommandubseriesfontseriesubselectfont
DeclareTextFontCommandtextububseries
newcommandeggsZiggy eats eggs.
begindocument
parbox160pt
textuleggs texteleggs textlfeggs textmdeggs textmbeggs
textsbeggs textdbeggs textbfeggs textebeggs textubeggs
textittextuleggs texteleggs textlfeggs textmdeggs
textmbeggs textsbeggs textdbeggs textbfeggs textebeggs
textubeggs
enddocument
1
tex.stackexchange.com/q/434273 is relevant if youâÂÂre trying to work with newer versions than those in TeX Live.
â Thérèse
Aug 25 at 18:37
@Thérèse Thanks! In practice, I would either stick my own version of the fonts in a project directory and use fontspecâÂÂsPath =
feature to override the (inconsistent) default search paths, or else change the filename, e.g. toFiraSans4.3-Regular.otf
,
â Davislor
Aug 25 at 23:42
What is the purpose of thefirasans
package?
â AndreKR
Aug 26 at 9:52
@AndreKR I wondered that as well. If one is usingfontspec
, why not just go withsetmainfontFiraSans
? Does the package get you anything extra?
â Derek
Aug 26 at 16:37
I added a second solution using onlyfontspec
. (And also fixed a bug with bold text in the first MWE.)
â Davislor
Aug 26 at 20:10
add a comment |Â
up vote
7
down vote
accepted
up vote
7
down vote
accepted
The following workaround enables you to change the letter g without also changing the letter a, in the upright font. First, download the updated version (4.301) of the font files (or at least the ones that are in TEXMF/fonts/opentype/public/fira
into a subdirectory of your project directory, named fonts
.
This version contains the substitution you want as Stylistic Set 5. You can tell fontspec
to look in your projectâÂÂs fonts
directory for Fira Sans and to add this stylistic set on every upright font in the family that it will load in the future.
This will completely remove any ambiguity about which of the several versions of Fira Sans on your hard drive you want to load.
Then, load the firasans
package and get all its interfaces. Or load it yourself by the method of your choice.
documentclass[varwidth, preview]standalone
usepackagefontspec
% Requires version 4.301 of the font files to be stored in a subdirectory
% named fonts
defaultfontfeatures[FiraSans]
UprightFeatures = StylisticSet=5 ,
BoldFeatures = StylisticSet=5 ,
Path = ./fonts/
usepackage[sfdefault]firasans
begindocument
Ziggy eats eggs.
enddocument
If the package maintainer updates the version of the fonts in the TeX Live distribution, this hack will no longer be necessary. As of TeX Live 2018, it is.
Another Approach
The firasans
package is what you were using before, and has a number of options and support for different font weights. Since some commenters requested a solution using only fontspec
, here it is. This defines the de-facto standard LaTeX2e series names, as defined in the second edition of The LaTeX Companion and The LaTeX Font Installation Guide.
This version does not support all the weights of the font family, but it does support all the ones that correspond to LaTeX commands in common use, such as textlf
and sbseries
. For ordinary use, you might prefer to do what the package does and create a font family that selects relatively lighter or darker weights as its regular and bold.
It does define firafamily
for compatibility with firasans
, but doesnâÂÂt declare all the variants that package does.
It is also more future-proof, should the firasans
package ever change (for example, to load Fira Go).
documentclass[varwidth, preview]standalone
usepackagefontspec
% Requires version 4.301 of the font files to be stored in a subdirectory
% named fonts
setsansfontFiraSans[
Ligatures = Common, Discretionary, TeX ,
Numbers = Lining, OldStyle ,
Scale = 1.0 ,
FontFace = uln StylisticSet=5, Font = *-UltraLight,
FontFace = ulit*-UltraLightItalic,
FontFace = eln StylisticSet=5, Font = *-ExtraLight,
FontFace = elit*-ExtraLightItalic,
FontFace = ln StylisticSet=5, Font = *-Light,
FontFace = lit*-LightItalic,
UprightFont = *-Regular ,
UprightFeatures = StylisticSet=5 ,
ItalicFont = *-Italic ,
FontFace = mbn StylisticSet=5, Font = *-Book,
FontFace = mbit*-BookItalic,
FontFace = sbn StylisticSet=5, Font = *-Medium,
FontFace = sbit*-MediumItalic,
FontFace = dbn StylisticSet=5, Font = *-Semibold,
FontFace = dbit*-SemiboldItalic,
BoldFont = *-Bold ,
BoldFeatures = StylisticSet=5 ,
BoldItalicFont = *-BoldItalic ,
FontFace = ebn StylisticSet=5, Font = *-ExtraBold,
FontFace = ebit*-ExtraBoldItalic,
FontFace = ubn StylisticSet=5, Font = *-Heavy,
FontFace = ubit*-HeavyItalic,
Extension = .otf ,
Path = ./fonts/
]
letfirafamilysfdefault
renewcommand*familydefaultfirafamily
% Load other fonts here.
DeclareRobustCommandulseriesfontseriesulselectfont
DeclareTextFontCommandtextululseries
DeclareRobustCommandelseriesfontserieselselectfont
DeclareTextFontCommandtextelelseries
DeclareRobustCommandlfseriesfontserieslselectfont
DeclareTextFontCommandtextlflfseries
DeclareRobustCommandmbseriesfontseriesmbselectfont
DeclareTextFontCommandtextmbmbseries
DeclareRobustCommandsbseriesfontseriessbselectfont
DeclareTextFontCommandtextsbsbseries
DeclareRobustCommanddbseriesfontseriesdbselectfont
DeclareTextFontCommandtextdbdbseries
DeclareRobustCommandebseriesfontseriesebselectfont
DeclareTextFontCommandtextebebseries
DeclareRobustCommandubseriesfontseriesubselectfont
DeclareTextFontCommandtextububseries
newcommandeggsZiggy eats eggs.
begindocument
parbox160pt
textuleggs texteleggs textlfeggs textmdeggs textmbeggs
textsbeggs textdbeggs textbfeggs textebeggs textubeggs
textittextuleggs texteleggs textlfeggs textmdeggs
textmbeggs textsbeggs textdbeggs textbfeggs textebeggs
textubeggs
enddocument
The following workaround enables you to change the letter g without also changing the letter a, in the upright font. First, download the updated version (4.301) of the font files (or at least the ones that are in TEXMF/fonts/opentype/public/fira
into a subdirectory of your project directory, named fonts
.
This version contains the substitution you want as Stylistic Set 5. You can tell fontspec
to look in your projectâÂÂs fonts
directory for Fira Sans and to add this stylistic set on every upright font in the family that it will load in the future.
This will completely remove any ambiguity about which of the several versions of Fira Sans on your hard drive you want to load.
Then, load the firasans
package and get all its interfaces. Or load it yourself by the method of your choice.
documentclass[varwidth, preview]standalone
usepackagefontspec
% Requires version 4.301 of the font files to be stored in a subdirectory
% named fonts
defaultfontfeatures[FiraSans]
UprightFeatures = StylisticSet=5 ,
BoldFeatures = StylisticSet=5 ,
Path = ./fonts/
usepackage[sfdefault]firasans
begindocument
Ziggy eats eggs.
enddocument
If the package maintainer updates the version of the fonts in the TeX Live distribution, this hack will no longer be necessary. As of TeX Live 2018, it is.
Another Approach
The firasans
package is what you were using before, and has a number of options and support for different font weights. Since some commenters requested a solution using only fontspec
, here it is. This defines the de-facto standard LaTeX2e series names, as defined in the second edition of The LaTeX Companion and The LaTeX Font Installation Guide.
This version does not support all the weights of the font family, but it does support all the ones that correspond to LaTeX commands in common use, such as textlf
and sbseries
. For ordinary use, you might prefer to do what the package does and create a font family that selects relatively lighter or darker weights as its regular and bold.
It does define firafamily
for compatibility with firasans
, but doesnâÂÂt declare all the variants that package does.
It is also more future-proof, should the firasans
package ever change (for example, to load Fira Go).
documentclass[varwidth, preview]standalone
usepackagefontspec
% Requires version 4.301 of the font files to be stored in a subdirectory
% named fonts
setsansfontFiraSans[
Ligatures = Common, Discretionary, TeX ,
Numbers = Lining, OldStyle ,
Scale = 1.0 ,
FontFace = uln StylisticSet=5, Font = *-UltraLight,
FontFace = ulit*-UltraLightItalic,
FontFace = eln StylisticSet=5, Font = *-ExtraLight,
FontFace = elit*-ExtraLightItalic,
FontFace = ln StylisticSet=5, Font = *-Light,
FontFace = lit*-LightItalic,
UprightFont = *-Regular ,
UprightFeatures = StylisticSet=5 ,
ItalicFont = *-Italic ,
FontFace = mbn StylisticSet=5, Font = *-Book,
FontFace = mbit*-BookItalic,
FontFace = sbn StylisticSet=5, Font = *-Medium,
FontFace = sbit*-MediumItalic,
FontFace = dbn StylisticSet=5, Font = *-Semibold,
FontFace = dbit*-SemiboldItalic,
BoldFont = *-Bold ,
BoldFeatures = StylisticSet=5 ,
BoldItalicFont = *-BoldItalic ,
FontFace = ebn StylisticSet=5, Font = *-ExtraBold,
FontFace = ebit*-ExtraBoldItalic,
FontFace = ubn StylisticSet=5, Font = *-Heavy,
FontFace = ubit*-HeavyItalic,
Extension = .otf ,
Path = ./fonts/
]
letfirafamilysfdefault
renewcommand*familydefaultfirafamily
% Load other fonts here.
DeclareRobustCommandulseriesfontseriesulselectfont
DeclareTextFontCommandtextululseries
DeclareRobustCommandelseriesfontserieselselectfont
DeclareTextFontCommandtextelelseries
DeclareRobustCommandlfseriesfontserieslselectfont
DeclareTextFontCommandtextlflfseries
DeclareRobustCommandmbseriesfontseriesmbselectfont
DeclareTextFontCommandtextmbmbseries
DeclareRobustCommandsbseriesfontseriessbselectfont
DeclareTextFontCommandtextsbsbseries
DeclareRobustCommanddbseriesfontseriesdbselectfont
DeclareTextFontCommandtextdbdbseries
DeclareRobustCommandebseriesfontseriesebselectfont
DeclareTextFontCommandtextebebseries
DeclareRobustCommandubseriesfontseriesubselectfont
DeclareTextFontCommandtextububseries
newcommandeggsZiggy eats eggs.
begindocument
parbox160pt
textuleggs texteleggs textlfeggs textmdeggs textmbeggs
textsbeggs textdbeggs textbfeggs textebeggs textubeggs
textittextuleggs texteleggs textlfeggs textmdeggs
textmbeggs textsbeggs textdbeggs textbfeggs textebeggs
textubeggs
enddocument
edited Aug 26 at 20:53
answered Aug 25 at 18:27
Davislor
3,662720
3,662720
1
tex.stackexchange.com/q/434273 is relevant if youâÂÂre trying to work with newer versions than those in TeX Live.
â Thérèse
Aug 25 at 18:37
@Thérèse Thanks! In practice, I would either stick my own version of the fonts in a project directory and use fontspecâÂÂsPath =
feature to override the (inconsistent) default search paths, or else change the filename, e.g. toFiraSans4.3-Regular.otf
,
â Davislor
Aug 25 at 23:42
What is the purpose of thefirasans
package?
â AndreKR
Aug 26 at 9:52
@AndreKR I wondered that as well. If one is usingfontspec
, why not just go withsetmainfontFiraSans
? Does the package get you anything extra?
â Derek
Aug 26 at 16:37
I added a second solution using onlyfontspec
. (And also fixed a bug with bold text in the first MWE.)
â Davislor
Aug 26 at 20:10
add a comment |Â
1
tex.stackexchange.com/q/434273 is relevant if youâÂÂre trying to work with newer versions than those in TeX Live.
â Thérèse
Aug 25 at 18:37
@Thérèse Thanks! In practice, I would either stick my own version of the fonts in a project directory and use fontspecâÂÂsPath =
feature to override the (inconsistent) default search paths, or else change the filename, e.g. toFiraSans4.3-Regular.otf
,
â Davislor
Aug 25 at 23:42
What is the purpose of thefirasans
package?
â AndreKR
Aug 26 at 9:52
@AndreKR I wondered that as well. If one is usingfontspec
, why not just go withsetmainfontFiraSans
? Does the package get you anything extra?
â Derek
Aug 26 at 16:37
I added a second solution using onlyfontspec
. (And also fixed a bug with bold text in the first MWE.)
â Davislor
Aug 26 at 20:10
1
1
tex.stackexchange.com/q/434273 is relevant if youâÂÂre trying to work with newer versions than those in TeX Live.
â Thérèse
Aug 25 at 18:37
tex.stackexchange.com/q/434273 is relevant if youâÂÂre trying to work with newer versions than those in TeX Live.
â Thérèse
Aug 25 at 18:37
@Thérèse Thanks! In practice, I would either stick my own version of the fonts in a project directory and use fontspecâÂÂs
Path =
feature to override the (inconsistent) default search paths, or else change the filename, e.g. to FiraSans4.3-Regular.otf
,â Davislor
Aug 25 at 23:42
@Thérèse Thanks! In practice, I would either stick my own version of the fonts in a project directory and use fontspecâÂÂs
Path =
feature to override the (inconsistent) default search paths, or else change the filename, e.g. to FiraSans4.3-Regular.otf
,â Davislor
Aug 25 at 23:42
What is the purpose of the
firasans
package?â AndreKR
Aug 26 at 9:52
What is the purpose of the
firasans
package?â AndreKR
Aug 26 at 9:52
@AndreKR I wondered that as well. If one is using
fontspec
, why not just go with setmainfontFiraSans
? Does the package get you anything extra?â Derek
Aug 26 at 16:37
@AndreKR I wondered that as well. If one is using
fontspec
, why not just go with setmainfontFiraSans
? Does the package get you anything extra?â Derek
Aug 26 at 16:37
I added a second solution using only
fontspec
. (And also fixed a bug with bold text in the first MWE.)â Davislor
Aug 26 at 20:10
I added a second solution using only
fontspec
. (And also fixed a bug with bold text in the first MWE.)â Davislor
Aug 26 at 20:10
add a comment |Â
up vote
11
down vote
If you are using LuaLaTeX and the OTF version of the fonts you can try
documentclass[a4paper]article
usepackagefontspec
directlua
fonts.handlers.otf.addfeature
name = "galt",
type = "substitution",
data = ["g"] = 0x210A,
setmainfont[RawFeature=+galt]FiraSans
begindocument
gg
emphgg
enddocument
add a comment |Â
up vote
11
down vote
If you are using LuaLaTeX and the OTF version of the fonts you can try
documentclass[a4paper]article
usepackagefontspec
directlua
fonts.handlers.otf.addfeature
name = "galt",
type = "substitution",
data = ["g"] = 0x210A,
setmainfont[RawFeature=+galt]FiraSans
begindocument
gg
emphgg
enddocument
add a comment |Â
up vote
11
down vote
up vote
11
down vote
If you are using LuaLaTeX and the OTF version of the fonts you can try
documentclass[a4paper]article
usepackagefontspec
directlua
fonts.handlers.otf.addfeature
name = "galt",
type = "substitution",
data = ["g"] = 0x210A,
setmainfont[RawFeature=+galt]FiraSans
begindocument
gg
emphgg
enddocument
If you are using LuaLaTeX and the OTF version of the fonts you can try
documentclass[a4paper]article
usepackagefontspec
directlua
fonts.handlers.otf.addfeature
name = "galt",
type = "substitution",
data = ["g"] = 0x210A,
setmainfont[RawFeature=+galt]FiraSans
begindocument
gg
emphgg
enddocument
answered Aug 25 at 16:21
moewe
74.9k797285
74.9k797285
add a comment |Â
add a comment |Â
up vote
10
down vote
This is easy if you use fontspec
and xelatex
:
documentclassarticle
usepackagefontspec
setmainfont[StylisticSet=4]FiraSans-Medium.otf
begindocument
Ziggy eats eggs.
enddocument
Update:
Thérèse's note raises an excellent point: if you do it this way, you change the look of both "a" and "g". Just FYI.
There is one question: this method has changed the letter a. Can we not change the letter a?
â poorich
Aug 25 at 17:09
As far as I'm aware, specifyingStylisticSet
is all-or-nothing â you can't pick and choose characters. But I'm not 100% sure I'm right about that.
â Derek
Aug 25 at 17:11
2
The solution of @moewe doesnâÂÂt affect the âÂÂaâ â this is one great advantage to luatex.
â Thérèse
Aug 25 at 17:14
add a comment |Â
up vote
10
down vote
This is easy if you use fontspec
and xelatex
:
documentclassarticle
usepackagefontspec
setmainfont[StylisticSet=4]FiraSans-Medium.otf
begindocument
Ziggy eats eggs.
enddocument
Update:
Thérèse's note raises an excellent point: if you do it this way, you change the look of both "a" and "g". Just FYI.
There is one question: this method has changed the letter a. Can we not change the letter a?
â poorich
Aug 25 at 17:09
As far as I'm aware, specifyingStylisticSet
is all-or-nothing â you can't pick and choose characters. But I'm not 100% sure I'm right about that.
â Derek
Aug 25 at 17:11
2
The solution of @moewe doesnâÂÂt affect the âÂÂaâ â this is one great advantage to luatex.
â Thérèse
Aug 25 at 17:14
add a comment |Â
up vote
10
down vote
up vote
10
down vote
This is easy if you use fontspec
and xelatex
:
documentclassarticle
usepackagefontspec
setmainfont[StylisticSet=4]FiraSans-Medium.otf
begindocument
Ziggy eats eggs.
enddocument
Update:
Thérèse's note raises an excellent point: if you do it this way, you change the look of both "a" and "g". Just FYI.
This is easy if you use fontspec
and xelatex
:
documentclassarticle
usepackagefontspec
setmainfont[StylisticSet=4]FiraSans-Medium.otf
begindocument
Ziggy eats eggs.
enddocument
Update:
Thérèse's note raises an excellent point: if you do it this way, you change the look of both "a" and "g". Just FYI.
edited Aug 25 at 17:09
answered Aug 25 at 17:01
Derek
1,212513
1,212513
There is one question: this method has changed the letter a. Can we not change the letter a?
â poorich
Aug 25 at 17:09
As far as I'm aware, specifyingStylisticSet
is all-or-nothing â you can't pick and choose characters. But I'm not 100% sure I'm right about that.
â Derek
Aug 25 at 17:11
2
The solution of @moewe doesnâÂÂt affect the âÂÂaâ â this is one great advantage to luatex.
â Thérèse
Aug 25 at 17:14
add a comment |Â
There is one question: this method has changed the letter a. Can we not change the letter a?
â poorich
Aug 25 at 17:09
As far as I'm aware, specifyingStylisticSet
is all-or-nothing â you can't pick and choose characters. But I'm not 100% sure I'm right about that.
â Derek
Aug 25 at 17:11
2
The solution of @moewe doesnâÂÂt affect the âÂÂaâ â this is one great advantage to luatex.
â Thérèse
Aug 25 at 17:14
There is one question: this method has changed the letter a. Can we not change the letter a?
â poorich
Aug 25 at 17:09
There is one question: this method has changed the letter a. Can we not change the letter a?
â poorich
Aug 25 at 17:09
As far as I'm aware, specifying
StylisticSet
is all-or-nothing â you can't pick and choose characters. But I'm not 100% sure I'm right about that.â Derek
Aug 25 at 17:11
As far as I'm aware, specifying
StylisticSet
is all-or-nothing â you can't pick and choose characters. But I'm not 100% sure I'm right about that.â Derek
Aug 25 at 17:11
2
2
The solution of @moewe doesnâÂÂt affect the âÂÂaâ â this is one great advantage to luatex.
â Thérèse
Aug 25 at 17:14
The solution of @moewe doesnâÂÂt affect the âÂÂaâ â this is one great advantage to luatex.
â Thérèse
Aug 25 at 17:14
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f447690%2fhow-to-replace-a-letter%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Do you use XeLaTeX or LuaLaTeX with the
.otf
fonts or pdfLaTeX with Type 1 fonts?â moewe
Aug 25 at 16:13
6
If you switch to FiraGO (bboxtype.com), the successor to Fira Sans 4.3,
ss05
controls âÂÂgâ and only âÂÂgâÂÂ, whereas in Fira Sansss04
controls both âÂÂgâ and âÂÂaâÂÂ.â Thérèse
Aug 25 at 16:54
@Thérèse Are the stylistic sets and alternatives of the font families documented anywhere, or do we just have to look it up in a program like FontForge?
â Davislor
Aug 25 at 17:59
@Davislor Some designers and foundries provide documentation, and others donâÂÂt. FiraGo comes with several PDF files, and those called âÂÂTechnical_Report*.pdfâ dcoument the features.
â Thérèse
Aug 25 at 18:03
@Thérèse Ah! I did look through that document, but I didn't see it until I searched. According to pages 37âÂÂ38, Stylistic Set 5 ought to work in Fira Sans as well.
â Davislor
Aug 25 at 18:10