How to replace a letter?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
8
down vote

favorite












When I use font package FiraSans



I enter "g", get



enter image description here



But actually I want to get



enter image description here



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.







share|improve this question




















  • 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 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










  • @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














up vote
8
down vote

favorite












When I use font package FiraSans



I enter "g", get



enter image description here



But actually I want to get



enter image description here



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.







share|improve this question




















  • 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 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










  • @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












up vote
8
down vote

favorite









up vote
8
down vote

favorite











When I use font package FiraSans



I enter "g", get



enter image description here



But actually I want to get



enter image description here



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.







share|improve this question












When I use font package FiraSans



I enter "g", get



enter image description here



But actually I want to get



enter image description here



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.









share|improve this question











share|improve this question




share|improve this question










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 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










  • @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






  • 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











  • @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










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


Fira Sans Stylistic Set 5



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


Does Ziggy eat eggs?






share|improve this answer


















  • 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’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










  • @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

















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


four g's in FiraSans






share|improve this answer



























    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


    enter image description here



    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.






    share|improve this answer






















    • 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






    • 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










    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "85"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    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






























    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


    Fira Sans Stylistic Set 5



    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


    Does Ziggy eat eggs?






    share|improve this answer


















    • 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’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










    • @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














    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


    Fira Sans Stylistic Set 5



    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


    Does Ziggy eat eggs?






    share|improve this answer


















    • 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’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










    • @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












    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


    Fira Sans Stylistic Set 5



    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


    Does Ziggy eat eggs?






    share|improve this answer














    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


    Fira Sans Stylistic Set 5



    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


    Does Ziggy eat eggs?







    share|improve this answer














    share|improve this answer



    share|improve this answer








    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’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










    • @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












    • 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’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










    • @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







    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










    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


    four g's in FiraSans






    share|improve this answer
























      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


      four g's in FiraSans






      share|improve this answer






















        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


        four g's in FiraSans






        share|improve this answer












        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


        four g's in FiraSans







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 25 at 16:21









        moewe

        74.9k797285




        74.9k797285




















            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


            enter image description here



            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.






            share|improve this answer






















            • 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






            • 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














            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


            enter image description here



            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.






            share|improve this answer






















            • 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






            • 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












            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


            enter image description here



            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.






            share|improve this answer














            This is easy if you use fontspec and xelatex:



            documentclassarticle
            usepackagefontspec
            setmainfont[StylisticSet=4]FiraSans-Medium.otf

            begindocument
            Ziggy eats eggs.
            enddocument


            enter image description here



            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.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            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, 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




              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










            • 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




              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

















             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            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













































































            Comments

            Popular posts from this blog

            Long meetings (6-7 hours a day): Being “babysat” by supervisor

            Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

            Confectionery