What is the least resource intensive way to generate the luatex font cache for a new font?Using MinionPro for the main font and Fontspec for the monospaced fontHow to generate compounded diacritical fonts for Sanskrit with XeTeX and LuaTeX?What is the .ttf font for default LaTeX font?how to set font feature file for a specific font file and not the whole font shapeWhat is the default font for LaTeX?What is the best Math Font for use with Minion Pro font?What is the least invasive way to set the font for listings?LuaLatex setup a different font for numbers and the restMaking a new font family based on the default fontWhat is the correct way to make setmainfont take effect?
How do you respond to a colleague from another team when they're wrongly expecting that you'll help them?
Could the E-bike drivetrain wear down till needing replacement after 400 km?
Is camera lens focus an exact point or a range?
If a character with the Alert feat rolls a crit fail on their Perception check, are they surprised?
What is the difference between "Do you interest" and "...interested in" something?
Why has "pence" been used in this sentence, not "pences"?
Can I use my Chinese passport to enter China after I acquired another citizenship?
Proving a function is onto where f(x)=|x|.
Did arcade monitors have same pixel aspect ratio as TV sets?
Is it improper etiquette to ask your opponent what his/her rating is before the game?
What's the difference between 違法 and 不法?
Is it better practice to read straight from sheet music rather than memorize it?
Diode in opposite direction?
When quoting, must I also copy hyphens used to divide words that continue on the next line?
How do ground effect vehicles perform turns?
Are lightweight LN wallets vulnerable to transaction withholding?
How much character growth crosses the line into breaking the character
Does having a TSA Pre-Check member in your flight reservation increase the chances that everyone gets Pre-Check?
Query about absorption line spectra
Two-sided logarithm inequality
How must one send away the mother bird?
My friend sent me a screenshot of a transaction hash, but when I search for it I find divergent data. What happened?
Open a doc from terminal, but not by its name
Should I install hardwood flooring or cabinets first?
What is the least resource intensive way to generate the luatex font cache for a new font?
Using MinionPro for the main font and Fontspec for the monospaced fontHow to generate compounded diacritical fonts for Sanskrit with XeTeX and LuaTeX?What is the .ttf font for default LaTeX font?how to set font feature file for a specific font file and not the whole font shapeWhat is the default font for LaTeX?What is the best Math Font for use with Minion Pro font?What is the least invasive way to set the font for listings?LuaLatex setup a different font for numbers and the restMaking a new font family based on the default fontWhat is the correct way to make setmainfont take effect?
When a font is first used with lualatex
, luaotfload
does some magic to produce font cache files.
For large fonts (e.g., Noto Sans CJK) this can take a lot of time and a lot of memory.
I have an old computer (5 year old MacBook air with 4GB RAM) running Linux with a 4GB swap partition. The initial cache generation of this font can take more than 15 min and render my computer unusable. Sometimes I just run out of memory and the process is killed.
Let's say I want to use the font as such:
documentclassarticle
usepackagefontspec
setmainfont[Script=CJK,Language=Chinese Simplified]Noto Sans CJK SC
begindocument
中文
enddocument
What is the least resource intensive way and/or fastest way to generate the required cache files?
At the moment, I quit everything (even X11) and run lualatex
from the console, but it still takes a long time, and quitting everything is a bit of a pain.
fonts luatex fontspec luaotfload
add a comment |
When a font is first used with lualatex
, luaotfload
does some magic to produce font cache files.
For large fonts (e.g., Noto Sans CJK) this can take a lot of time and a lot of memory.
I have an old computer (5 year old MacBook air with 4GB RAM) running Linux with a 4GB swap partition. The initial cache generation of this font can take more than 15 min and render my computer unusable. Sometimes I just run out of memory and the process is killed.
Let's say I want to use the font as such:
documentclassarticle
usepackagefontspec
setmainfont[Script=CJK,Language=Chinese Simplified]Noto Sans CJK SC
begindocument
中文
enddocument
What is the least resource intensive way and/or fastest way to generate the required cache files?
At the moment, I quit everything (even X11) and run lualatex
from the console, but it still takes a long time, and quitting everything is a bit of a pain.
fonts luatex fontspec luaotfload
1
That is a very good question, but I don't think you can do any better as you do now. Here is Hans' statement about this: mailman.ntg.nl/pipermail/ntg-context/2018/092703.html
– Henri Menke
Mar 16 at 7:49
xelatex
might be an alternative if you don't need lua-specifics, justfontspec
.
– Joseph
Mar 16 at 11:23
@Joseph, yesxelatex
has no problems of course. Although I notice something curious withxelatex
. I use the true type collection font:NotoSansCJK-Regular.ttc
. When I runpdffonts
on the the PDF file produced byxelatex
it gives:ROREZJ+NotoSansCJKjp-Regular-Identity-H
. (Noticejp
for Japanese instead ofsc
for Simplified Chinese as requested). I don't know where the error is though. I guess itxelatex
could be embedding the right font from thettc
but with the wrong name.
– David Purton
Mar 16 at 11:38
As an addition to my previous comment: I'm pretty sure the output is correct even though the font reported is always thejp
one. All the language specific fonts contain all glyphs and the right language seems to be automatically used byxelatex
when you request a language specific font without manually specifying theLanguage=
option offontspec
.
– David Purton
Mar 16 at 13:11
add a comment |
When a font is first used with lualatex
, luaotfload
does some magic to produce font cache files.
For large fonts (e.g., Noto Sans CJK) this can take a lot of time and a lot of memory.
I have an old computer (5 year old MacBook air with 4GB RAM) running Linux with a 4GB swap partition. The initial cache generation of this font can take more than 15 min and render my computer unusable. Sometimes I just run out of memory and the process is killed.
Let's say I want to use the font as such:
documentclassarticle
usepackagefontspec
setmainfont[Script=CJK,Language=Chinese Simplified]Noto Sans CJK SC
begindocument
中文
enddocument
What is the least resource intensive way and/or fastest way to generate the required cache files?
At the moment, I quit everything (even X11) and run lualatex
from the console, but it still takes a long time, and quitting everything is a bit of a pain.
fonts luatex fontspec luaotfload
When a font is first used with lualatex
, luaotfload
does some magic to produce font cache files.
For large fonts (e.g., Noto Sans CJK) this can take a lot of time and a lot of memory.
I have an old computer (5 year old MacBook air with 4GB RAM) running Linux with a 4GB swap partition. The initial cache generation of this font can take more than 15 min and render my computer unusable. Sometimes I just run out of memory and the process is killed.
Let's say I want to use the font as such:
documentclassarticle
usepackagefontspec
setmainfont[Script=CJK,Language=Chinese Simplified]Noto Sans CJK SC
begindocument
中文
enddocument
What is the least resource intensive way and/or fastest way to generate the required cache files?
At the moment, I quit everything (even X11) and run lualatex
from the console, but it still takes a long time, and quitting everything is a bit of a pain.
fonts luatex fontspec luaotfload
fonts luatex fontspec luaotfload
asked Mar 16 at 4:44
David PurtonDavid Purton
10.9k2941
10.9k2941
1
That is a very good question, but I don't think you can do any better as you do now. Here is Hans' statement about this: mailman.ntg.nl/pipermail/ntg-context/2018/092703.html
– Henri Menke
Mar 16 at 7:49
xelatex
might be an alternative if you don't need lua-specifics, justfontspec
.
– Joseph
Mar 16 at 11:23
@Joseph, yesxelatex
has no problems of course. Although I notice something curious withxelatex
. I use the true type collection font:NotoSansCJK-Regular.ttc
. When I runpdffonts
on the the PDF file produced byxelatex
it gives:ROREZJ+NotoSansCJKjp-Regular-Identity-H
. (Noticejp
for Japanese instead ofsc
for Simplified Chinese as requested). I don't know where the error is though. I guess itxelatex
could be embedding the right font from thettc
but with the wrong name.
– David Purton
Mar 16 at 11:38
As an addition to my previous comment: I'm pretty sure the output is correct even though the font reported is always thejp
one. All the language specific fonts contain all glyphs and the right language seems to be automatically used byxelatex
when you request a language specific font without manually specifying theLanguage=
option offontspec
.
– David Purton
Mar 16 at 13:11
add a comment |
1
That is a very good question, but I don't think you can do any better as you do now. Here is Hans' statement about this: mailman.ntg.nl/pipermail/ntg-context/2018/092703.html
– Henri Menke
Mar 16 at 7:49
xelatex
might be an alternative if you don't need lua-specifics, justfontspec
.
– Joseph
Mar 16 at 11:23
@Joseph, yesxelatex
has no problems of course. Although I notice something curious withxelatex
. I use the true type collection font:NotoSansCJK-Regular.ttc
. When I runpdffonts
on the the PDF file produced byxelatex
it gives:ROREZJ+NotoSansCJKjp-Regular-Identity-H
. (Noticejp
for Japanese instead ofsc
for Simplified Chinese as requested). I don't know where the error is though. I guess itxelatex
could be embedding the right font from thettc
but with the wrong name.
– David Purton
Mar 16 at 11:38
As an addition to my previous comment: I'm pretty sure the output is correct even though the font reported is always thejp
one. All the language specific fonts contain all glyphs and the right language seems to be automatically used byxelatex
when you request a language specific font without manually specifying theLanguage=
option offontspec
.
– David Purton
Mar 16 at 13:11
1
1
That is a very good question, but I don't think you can do any better as you do now. Here is Hans' statement about this: mailman.ntg.nl/pipermail/ntg-context/2018/092703.html
– Henri Menke
Mar 16 at 7:49
That is a very good question, but I don't think you can do any better as you do now. Here is Hans' statement about this: mailman.ntg.nl/pipermail/ntg-context/2018/092703.html
– Henri Menke
Mar 16 at 7:49
xelatex
might be an alternative if you don't need lua-specifics, just fontspec
.– Joseph
Mar 16 at 11:23
xelatex
might be an alternative if you don't need lua-specifics, just fontspec
.– Joseph
Mar 16 at 11:23
@Joseph, yes
xelatex
has no problems of course. Although I notice something curious with xelatex
. I use the true type collection font: NotoSansCJK-Regular.ttc
. When I run pdffonts
on the the PDF file produced by xelatex
it gives: ROREZJ+NotoSansCJKjp-Regular-Identity-H
. (Notice jp
for Japanese instead of sc
for Simplified Chinese as requested). I don't know where the error is though. I guess it xelatex
could be embedding the right font from the ttc
but with the wrong name.– David Purton
Mar 16 at 11:38
@Joseph, yes
xelatex
has no problems of course. Although I notice something curious with xelatex
. I use the true type collection font: NotoSansCJK-Regular.ttc
. When I run pdffonts
on the the PDF file produced by xelatex
it gives: ROREZJ+NotoSansCJKjp-Regular-Identity-H
. (Notice jp
for Japanese instead of sc
for Simplified Chinese as requested). I don't know where the error is though. I guess it xelatex
could be embedding the right font from the ttc
but with the wrong name.– David Purton
Mar 16 at 11:38
As an addition to my previous comment: I'm pretty sure the output is correct even though the font reported is always the
jp
one. All the language specific fonts contain all glyphs and the right language seems to be automatically used by xelatex
when you request a language specific font without manually specifying the Language=
option of fontspec
.– David Purton
Mar 16 at 13:11
As an addition to my previous comment: I'm pretty sure the output is correct even though the font reported is always the
jp
one. All the language specific fonts contain all glyphs and the right language seems to be automatically used by xelatex
when you request a language specific font without manually specifying the Language=
option of fontspec
.– David Purton
Mar 16 at 13:11
add a comment |
1 Answer
1
active
oldest
votes
You can do as proposed in section 9.2.1 “Trimming fonts“ in Fonts out of ConTeXt and remove all the glyph names in the font.
Adapted to LaTeX and your example:
documentclassarticle
usepackagefontspec,luacode
beginluacode*
fonts.handlers.otf.readers.registerextender
name = "remove names from Noto Sans CJK SC",
action = function(fontdata)
if string.match(fontdata.metadata.fullname, "Noto Sans CJK SC") then
texio.write_nl("Trimming font " .. fontdata.metadata.fullname)
for k, v in next, fontdata.descriptions do
v.name = nil
end
end
end
endluacode*
setmainfont[Script=CJK,Language=Chinese Simplified]Noto Sans CJK SC
begindocument
中文
enddocument
Can this solution be problematic in some cases?
– Paul Gaborit
Mar 16 at 8:21
@PaulGaborit Yes, anything that wants to access glyphs by name won't work. In ConTeXt there isgetnamedglyphdirect
which will break. I don't think there is anything like this in LaTeX. Also those name lookups are not very efficient.
– Henri Menke
Mar 16 at 8:28
Well, I did manage to successfully generate cache files for Source Han Serif (regular, bold). Chromium was killed to compensate, used up all my RAM, and took half an hour! But it did work. Without yourlua
code I didn't manage to complete the compile without it being killed. So that's something.
– David Purton
Mar 16 at 10:57
add a comment |
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',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f479744%2fwhat-is-the-least-resource-intensive-way-to-generate-the-luatex-font-cache-for-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can do as proposed in section 9.2.1 “Trimming fonts“ in Fonts out of ConTeXt and remove all the glyph names in the font.
Adapted to LaTeX and your example:
documentclassarticle
usepackagefontspec,luacode
beginluacode*
fonts.handlers.otf.readers.registerextender
name = "remove names from Noto Sans CJK SC",
action = function(fontdata)
if string.match(fontdata.metadata.fullname, "Noto Sans CJK SC") then
texio.write_nl("Trimming font " .. fontdata.metadata.fullname)
for k, v in next, fontdata.descriptions do
v.name = nil
end
end
end
endluacode*
setmainfont[Script=CJK,Language=Chinese Simplified]Noto Sans CJK SC
begindocument
中文
enddocument
Can this solution be problematic in some cases?
– Paul Gaborit
Mar 16 at 8:21
@PaulGaborit Yes, anything that wants to access glyphs by name won't work. In ConTeXt there isgetnamedglyphdirect
which will break. I don't think there is anything like this in LaTeX. Also those name lookups are not very efficient.
– Henri Menke
Mar 16 at 8:28
Well, I did manage to successfully generate cache files for Source Han Serif (regular, bold). Chromium was killed to compensate, used up all my RAM, and took half an hour! But it did work. Without yourlua
code I didn't manage to complete the compile without it being killed. So that's something.
– David Purton
Mar 16 at 10:57
add a comment |
You can do as proposed in section 9.2.1 “Trimming fonts“ in Fonts out of ConTeXt and remove all the glyph names in the font.
Adapted to LaTeX and your example:
documentclassarticle
usepackagefontspec,luacode
beginluacode*
fonts.handlers.otf.readers.registerextender
name = "remove names from Noto Sans CJK SC",
action = function(fontdata)
if string.match(fontdata.metadata.fullname, "Noto Sans CJK SC") then
texio.write_nl("Trimming font " .. fontdata.metadata.fullname)
for k, v in next, fontdata.descriptions do
v.name = nil
end
end
end
endluacode*
setmainfont[Script=CJK,Language=Chinese Simplified]Noto Sans CJK SC
begindocument
中文
enddocument
Can this solution be problematic in some cases?
– Paul Gaborit
Mar 16 at 8:21
@PaulGaborit Yes, anything that wants to access glyphs by name won't work. In ConTeXt there isgetnamedglyphdirect
which will break. I don't think there is anything like this in LaTeX. Also those name lookups are not very efficient.
– Henri Menke
Mar 16 at 8:28
Well, I did manage to successfully generate cache files for Source Han Serif (regular, bold). Chromium was killed to compensate, used up all my RAM, and took half an hour! But it did work. Without yourlua
code I didn't manage to complete the compile without it being killed. So that's something.
– David Purton
Mar 16 at 10:57
add a comment |
You can do as proposed in section 9.2.1 “Trimming fonts“ in Fonts out of ConTeXt and remove all the glyph names in the font.
Adapted to LaTeX and your example:
documentclassarticle
usepackagefontspec,luacode
beginluacode*
fonts.handlers.otf.readers.registerextender
name = "remove names from Noto Sans CJK SC",
action = function(fontdata)
if string.match(fontdata.metadata.fullname, "Noto Sans CJK SC") then
texio.write_nl("Trimming font " .. fontdata.metadata.fullname)
for k, v in next, fontdata.descriptions do
v.name = nil
end
end
end
endluacode*
setmainfont[Script=CJK,Language=Chinese Simplified]Noto Sans CJK SC
begindocument
中文
enddocument
You can do as proposed in section 9.2.1 “Trimming fonts“ in Fonts out of ConTeXt and remove all the glyph names in the font.
Adapted to LaTeX and your example:
documentclassarticle
usepackagefontspec,luacode
beginluacode*
fonts.handlers.otf.readers.registerextender
name = "remove names from Noto Sans CJK SC",
action = function(fontdata)
if string.match(fontdata.metadata.fullname, "Noto Sans CJK SC") then
texio.write_nl("Trimming font " .. fontdata.metadata.fullname)
for k, v in next, fontdata.descriptions do
v.name = nil
end
end
end
endluacode*
setmainfont[Script=CJK,Language=Chinese Simplified]Noto Sans CJK SC
begindocument
中文
enddocument
answered Mar 16 at 8:08
Henri MenkeHenri Menke
77k8170284
77k8170284
Can this solution be problematic in some cases?
– Paul Gaborit
Mar 16 at 8:21
@PaulGaborit Yes, anything that wants to access glyphs by name won't work. In ConTeXt there isgetnamedglyphdirect
which will break. I don't think there is anything like this in LaTeX. Also those name lookups are not very efficient.
– Henri Menke
Mar 16 at 8:28
Well, I did manage to successfully generate cache files for Source Han Serif (regular, bold). Chromium was killed to compensate, used up all my RAM, and took half an hour! But it did work. Without yourlua
code I didn't manage to complete the compile without it being killed. So that's something.
– David Purton
Mar 16 at 10:57
add a comment |
Can this solution be problematic in some cases?
– Paul Gaborit
Mar 16 at 8:21
@PaulGaborit Yes, anything that wants to access glyphs by name won't work. In ConTeXt there isgetnamedglyphdirect
which will break. I don't think there is anything like this in LaTeX. Also those name lookups are not very efficient.
– Henri Menke
Mar 16 at 8:28
Well, I did manage to successfully generate cache files for Source Han Serif (regular, bold). Chromium was killed to compensate, used up all my RAM, and took half an hour! But it did work. Without yourlua
code I didn't manage to complete the compile without it being killed. So that's something.
– David Purton
Mar 16 at 10:57
Can this solution be problematic in some cases?
– Paul Gaborit
Mar 16 at 8:21
Can this solution be problematic in some cases?
– Paul Gaborit
Mar 16 at 8:21
@PaulGaborit Yes, anything that wants to access glyphs by name won't work. In ConTeXt there is
getnamedglyphdirect
which will break. I don't think there is anything like this in LaTeX. Also those name lookups are not very efficient.– Henri Menke
Mar 16 at 8:28
@PaulGaborit Yes, anything that wants to access glyphs by name won't work. In ConTeXt there is
getnamedglyphdirect
which will break. I don't think there is anything like this in LaTeX. Also those name lookups are not very efficient.– Henri Menke
Mar 16 at 8:28
Well, I did manage to successfully generate cache files for Source Han Serif (regular, bold). Chromium was killed to compensate, used up all my RAM, and took half an hour! But it did work. Without your
lua
code I didn't manage to complete the compile without it being killed. So that's something.– David Purton
Mar 16 at 10:57
Well, I did manage to successfully generate cache files for Source Han Serif (regular, bold). Chromium was killed to compensate, used up all my RAM, and took half an hour! But it did work. Without your
lua
code I didn't manage to complete the compile without it being killed. So that's something.– David Purton
Mar 16 at 10:57
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f479744%2fwhat-is-the-least-resource-intensive-way-to-generate-the-luatex-font-cache-for-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
That is a very good question, but I don't think you can do any better as you do now. Here is Hans' statement about this: mailman.ntg.nl/pipermail/ntg-context/2018/092703.html
– Henri Menke
Mar 16 at 7:49
xelatex
might be an alternative if you don't need lua-specifics, justfontspec
.– Joseph
Mar 16 at 11:23
@Joseph, yes
xelatex
has no problems of course. Although I notice something curious withxelatex
. I use the true type collection font:NotoSansCJK-Regular.ttc
. When I runpdffonts
on the the PDF file produced byxelatex
it gives:ROREZJ+NotoSansCJKjp-Regular-Identity-H
. (Noticejp
for Japanese instead ofsc
for Simplified Chinese as requested). I don't know where the error is though. I guess itxelatex
could be embedding the right font from thettc
but with the wrong name.– David Purton
Mar 16 at 11:38
As an addition to my previous comment: I'm pretty sure the output is correct even though the font reported is always the
jp
one. All the language specific fonts contain all glyphs and the right language seems to be automatically used byxelatex
when you request a language specific font without manually specifying theLanguage=
option offontspec
.– David Purton
Mar 16 at 13:11