How to check the existence of some characters in a font using a loop?
I am trying to modify the current version of xepersian package
to suit my needs.
The following code copied from
xepersian-mathsdigitspec.sty
is supposed to check if some characters do exist in the font to be loaded.
My question is about the function __xepersian_mathsdigitspec_char_not_exist_error.
Is there any way to replace those repeating lines of code in the argument of the function with a (while, until, ...) LOOP
which iterates over a list of characters [06F0, ..., 066B]?
cs_new:Npn __xepersian_mathsdigitspec_error:nxx { msg_error:nnxx {xepersian-mathsdigitspec} }
cs_new:Nn __xepersian_mathsdigitspec_msg_new:nnnn
{ msg_new:nnxx {#1} {#2} { tl_trim_spaces:n {#3} } { tl_trim_spaces:n {#4} } }
char_set_catcode_space:n {32}
__xepersian_mathsdigitspec_msg_new:nnnn {xepersian-mathsdigitspec} {char-not-exist}
{
The font "#1" does not contain U+#2.
}
{
Select another font and rerun xelatex.
}
char_set_catcode_ignore:n {32}
prg_new_conditional:Nnn __xepersian_mathsdigitspec_primitive_font_char_if_exist:n {p,TF,T,F}
{
etex_iffontchar:D l_fontspec_font `#1 scan_stop:
prg_return_true:
else:
prg_return_false:
fi:
}
cs_new:Nn __xepersian_mathsdigitspec_char_not_exist_error:n
{
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۰ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F0 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۱ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F1 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۲ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F2 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۳ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F3 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۴ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F4 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۵ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F5 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۶ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F6 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۷ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F7 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۸ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F8 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۹ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F9 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٫ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066B } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٪ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066A } }
}
fontspec latex3 xepersian
add a comment |
I am trying to modify the current version of xepersian package
to suit my needs.
The following code copied from
xepersian-mathsdigitspec.sty
is supposed to check if some characters do exist in the font to be loaded.
My question is about the function __xepersian_mathsdigitspec_char_not_exist_error.
Is there any way to replace those repeating lines of code in the argument of the function with a (while, until, ...) LOOP
which iterates over a list of characters [06F0, ..., 066B]?
cs_new:Npn __xepersian_mathsdigitspec_error:nxx { msg_error:nnxx {xepersian-mathsdigitspec} }
cs_new:Nn __xepersian_mathsdigitspec_msg_new:nnnn
{ msg_new:nnxx {#1} {#2} { tl_trim_spaces:n {#3} } { tl_trim_spaces:n {#4} } }
char_set_catcode_space:n {32}
__xepersian_mathsdigitspec_msg_new:nnnn {xepersian-mathsdigitspec} {char-not-exist}
{
The font "#1" does not contain U+#2.
}
{
Select another font and rerun xelatex.
}
char_set_catcode_ignore:n {32}
prg_new_conditional:Nnn __xepersian_mathsdigitspec_primitive_font_char_if_exist:n {p,TF,T,F}
{
etex_iffontchar:D l_fontspec_font `#1 scan_stop:
prg_return_true:
else:
prg_return_false:
fi:
}
cs_new:Nn __xepersian_mathsdigitspec_char_not_exist_error:n
{
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۰ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F0 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۱ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F1 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۲ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F2 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۳ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F3 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۴ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F4 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۵ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F5 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۶ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F6 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۷ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F7 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۸ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F8 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۹ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F9 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٫ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066B } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٪ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066A } }
}
fontspec latex3 xepersian
If you just need to see if certain glyphs exist, why not just usefonttable, as indocumentclass{article} usepackage{fullpage} usepackage{fonttable} begin{document} fonttable{cmti10} fonttable{cmsy10} end{document}
– Steven B. Segletes
Dec 18 '18 at 11:52
Welcome to the site, as well. By the way, it is appropriate in your question to include a fully compiling example rather than just a code snippet or macro definition.
– Steven B. Segletes
Dec 18 '18 at 11:54
1
Thanks, Steven, the check for the existence of the characters must be done within the program. BTW, I tried too much to prepare a complete, small, and working example, but I couldn't, because I am a newbie.
– Tisha Shusho
Dec 18 '18 at 19:41
add a comment |
I am trying to modify the current version of xepersian package
to suit my needs.
The following code copied from
xepersian-mathsdigitspec.sty
is supposed to check if some characters do exist in the font to be loaded.
My question is about the function __xepersian_mathsdigitspec_char_not_exist_error.
Is there any way to replace those repeating lines of code in the argument of the function with a (while, until, ...) LOOP
which iterates over a list of characters [06F0, ..., 066B]?
cs_new:Npn __xepersian_mathsdigitspec_error:nxx { msg_error:nnxx {xepersian-mathsdigitspec} }
cs_new:Nn __xepersian_mathsdigitspec_msg_new:nnnn
{ msg_new:nnxx {#1} {#2} { tl_trim_spaces:n {#3} } { tl_trim_spaces:n {#4} } }
char_set_catcode_space:n {32}
__xepersian_mathsdigitspec_msg_new:nnnn {xepersian-mathsdigitspec} {char-not-exist}
{
The font "#1" does not contain U+#2.
}
{
Select another font and rerun xelatex.
}
char_set_catcode_ignore:n {32}
prg_new_conditional:Nnn __xepersian_mathsdigitspec_primitive_font_char_if_exist:n {p,TF,T,F}
{
etex_iffontchar:D l_fontspec_font `#1 scan_stop:
prg_return_true:
else:
prg_return_false:
fi:
}
cs_new:Nn __xepersian_mathsdigitspec_char_not_exist_error:n
{
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۰ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F0 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۱ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F1 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۲ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F2 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۳ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F3 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۴ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F4 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۵ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F5 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۶ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F6 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۷ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F7 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۸ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F8 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۹ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F9 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٫ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066B } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٪ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066A } }
}
fontspec latex3 xepersian
I am trying to modify the current version of xepersian package
to suit my needs.
The following code copied from
xepersian-mathsdigitspec.sty
is supposed to check if some characters do exist in the font to be loaded.
My question is about the function __xepersian_mathsdigitspec_char_not_exist_error.
Is there any way to replace those repeating lines of code in the argument of the function with a (while, until, ...) LOOP
which iterates over a list of characters [06F0, ..., 066B]?
cs_new:Npn __xepersian_mathsdigitspec_error:nxx { msg_error:nnxx {xepersian-mathsdigitspec} }
cs_new:Nn __xepersian_mathsdigitspec_msg_new:nnnn
{ msg_new:nnxx {#1} {#2} { tl_trim_spaces:n {#3} } { tl_trim_spaces:n {#4} } }
char_set_catcode_space:n {32}
__xepersian_mathsdigitspec_msg_new:nnnn {xepersian-mathsdigitspec} {char-not-exist}
{
The font "#1" does not contain U+#2.
}
{
Select another font and rerun xelatex.
}
char_set_catcode_ignore:n {32}
prg_new_conditional:Nnn __xepersian_mathsdigitspec_primitive_font_char_if_exist:n {p,TF,T,F}
{
etex_iffontchar:D l_fontspec_font `#1 scan_stop:
prg_return_true:
else:
prg_return_false:
fi:
}
cs_new:Nn __xepersian_mathsdigitspec_char_not_exist_error:n
{
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۰ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F0 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۱ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F1 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۲ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F2 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۳ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F3 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۴ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F4 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۵ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F5 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۶ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F6 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۷ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F7 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۸ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F8 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۹ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F9 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٫ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066B } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٪ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066A } }
}
fontspec latex3 xepersian
fontspec latex3 xepersian
asked Dec 14 '18 at 16:06
Tisha Shusho
175
175
If you just need to see if certain glyphs exist, why not just usefonttable, as indocumentclass{article} usepackage{fullpage} usepackage{fonttable} begin{document} fonttable{cmti10} fonttable{cmsy10} end{document}
– Steven B. Segletes
Dec 18 '18 at 11:52
Welcome to the site, as well. By the way, it is appropriate in your question to include a fully compiling example rather than just a code snippet or macro definition.
– Steven B. Segletes
Dec 18 '18 at 11:54
1
Thanks, Steven, the check for the existence of the characters must be done within the program. BTW, I tried too much to prepare a complete, small, and working example, but I couldn't, because I am a newbie.
– Tisha Shusho
Dec 18 '18 at 19:41
add a comment |
If you just need to see if certain glyphs exist, why not just usefonttable, as indocumentclass{article} usepackage{fullpage} usepackage{fonttable} begin{document} fonttable{cmti10} fonttable{cmsy10} end{document}
– Steven B. Segletes
Dec 18 '18 at 11:52
Welcome to the site, as well. By the way, it is appropriate in your question to include a fully compiling example rather than just a code snippet or macro definition.
– Steven B. Segletes
Dec 18 '18 at 11:54
1
Thanks, Steven, the check for the existence of the characters must be done within the program. BTW, I tried too much to prepare a complete, small, and working example, but I couldn't, because I am a newbie.
– Tisha Shusho
Dec 18 '18 at 19:41
If you just need to see if certain glyphs exist, why not just use
fonttable, as in documentclass{article} usepackage{fullpage} usepackage{fonttable} begin{document} fonttable{cmti10} fonttable{cmsy10} end{document}– Steven B. Segletes
Dec 18 '18 at 11:52
If you just need to see if certain glyphs exist, why not just use
fonttable, as in documentclass{article} usepackage{fullpage} usepackage{fonttable} begin{document} fonttable{cmti10} fonttable{cmsy10} end{document}– Steven B. Segletes
Dec 18 '18 at 11:52
Welcome to the site, as well. By the way, it is appropriate in your question to include a fully compiling example rather than just a code snippet or macro definition.
– Steven B. Segletes
Dec 18 '18 at 11:54
Welcome to the site, as well. By the way, it is appropriate in your question to include a fully compiling example rather than just a code snippet or macro definition.
– Steven B. Segletes
Dec 18 '18 at 11:54
1
1
Thanks, Steven, the check for the existence of the characters must be done within the program. BTW, I tried too much to prepare a complete, small, and working example, but I couldn't, because I am a newbie.
– Tisha Shusho
Dec 18 '18 at 19:41
Thanks, Steven, the check for the existence of the characters must be done within the program. BTW, I tried too much to prepare a complete, small, and working example, but I couldn't, because I am a newbie.
– Tisha Shusho
Dec 18 '18 at 19:41
add a comment |
1 Answer
1
active
oldest
votes
After reading the documents "The expl3 package and LaTeX3 programming" and the
"LaTeX3 Interfaces" again (but thoroughly this time) I think I have found a
solution to my question.
I replaced the following piece of code in xepersian-mathsdigitspec.sty:
prg_new_conditional:Nnn __xepersian_mathsdigitspec_primitive_font_char_if_exist:n {p,TF,T,F}
{
etex_iffontchar:D l_fontspec_font `#1 scan_stop:
prg_return_true:
else:
prg_return_false:
fi:
}
cs_new:Nn __xepersian_mathsdigitspec_char_not_exist_error:n
{
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۰ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F0 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۱ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F1 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۲ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F2 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۳ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F3 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۴ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F4 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۵ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F5 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۶ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F6 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۷ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F7 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۸ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F8 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۹ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F9 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٫ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066B } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٪ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066A } }
}
with
seq_new:N l_my_xepersian_digits_seq
seq_set_split:Nnn l_my_xepersian_digits_seq { , } { 06F0 , 06F1 , 06F2 , 06F3 , 06F4 , 06F5 , 06F6 , 06F7 , 06F8 , 06F9 , 066A , 066B }
and replaced all instances of the function
__xepersian_mathsdigitspec_char_not_exist_error with:
seq_map_inline:Nn l_my_xepersian_digits_seq
{
etex_iffontchar:D l_fontspec_font "##1 scan_stop:
else:
__xepersian_mathsdigitspec_error:nxx {char-not-exist} { #2 } { ##1 }
fi:
}
Of course one can use seq_map_function to define a new function and replace
all occurrences of the function __xepersian_mathsdigitspec_char_not_exist_error
with that.
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%2f464856%2fhow-to-check-the-existence-of-some-characters-in-a-font-using-a-loop%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
After reading the documents "The expl3 package and LaTeX3 programming" and the
"LaTeX3 Interfaces" again (but thoroughly this time) I think I have found a
solution to my question.
I replaced the following piece of code in xepersian-mathsdigitspec.sty:
prg_new_conditional:Nnn __xepersian_mathsdigitspec_primitive_font_char_if_exist:n {p,TF,T,F}
{
etex_iffontchar:D l_fontspec_font `#1 scan_stop:
prg_return_true:
else:
prg_return_false:
fi:
}
cs_new:Nn __xepersian_mathsdigitspec_char_not_exist_error:n
{
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۰ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F0 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۱ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F1 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۲ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F2 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۳ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F3 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۴ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F4 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۵ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F5 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۶ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F6 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۷ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F7 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۸ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F8 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۹ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F9 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٫ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066B } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٪ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066A } }
}
with
seq_new:N l_my_xepersian_digits_seq
seq_set_split:Nnn l_my_xepersian_digits_seq { , } { 06F0 , 06F1 , 06F2 , 06F3 , 06F4 , 06F5 , 06F6 , 06F7 , 06F8 , 06F9 , 066A , 066B }
and replaced all instances of the function
__xepersian_mathsdigitspec_char_not_exist_error with:
seq_map_inline:Nn l_my_xepersian_digits_seq
{
etex_iffontchar:D l_fontspec_font "##1 scan_stop:
else:
__xepersian_mathsdigitspec_error:nxx {char-not-exist} { #2 } { ##1 }
fi:
}
Of course one can use seq_map_function to define a new function and replace
all occurrences of the function __xepersian_mathsdigitspec_char_not_exist_error
with that.
add a comment |
After reading the documents "The expl3 package and LaTeX3 programming" and the
"LaTeX3 Interfaces" again (but thoroughly this time) I think I have found a
solution to my question.
I replaced the following piece of code in xepersian-mathsdigitspec.sty:
prg_new_conditional:Nnn __xepersian_mathsdigitspec_primitive_font_char_if_exist:n {p,TF,T,F}
{
etex_iffontchar:D l_fontspec_font `#1 scan_stop:
prg_return_true:
else:
prg_return_false:
fi:
}
cs_new:Nn __xepersian_mathsdigitspec_char_not_exist_error:n
{
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۰ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F0 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۱ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F1 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۲ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F2 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۳ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F3 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۴ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F4 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۵ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F5 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۶ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F6 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۷ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F7 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۸ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F8 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۹ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F9 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٫ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066B } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٪ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066A } }
}
with
seq_new:N l_my_xepersian_digits_seq
seq_set_split:Nnn l_my_xepersian_digits_seq { , } { 06F0 , 06F1 , 06F2 , 06F3 , 06F4 , 06F5 , 06F6 , 06F7 , 06F8 , 06F9 , 066A , 066B }
and replaced all instances of the function
__xepersian_mathsdigitspec_char_not_exist_error with:
seq_map_inline:Nn l_my_xepersian_digits_seq
{
etex_iffontchar:D l_fontspec_font "##1 scan_stop:
else:
__xepersian_mathsdigitspec_error:nxx {char-not-exist} { #2 } { ##1 }
fi:
}
Of course one can use seq_map_function to define a new function and replace
all occurrences of the function __xepersian_mathsdigitspec_char_not_exist_error
with that.
add a comment |
After reading the documents "The expl3 package and LaTeX3 programming" and the
"LaTeX3 Interfaces" again (but thoroughly this time) I think I have found a
solution to my question.
I replaced the following piece of code in xepersian-mathsdigitspec.sty:
prg_new_conditional:Nnn __xepersian_mathsdigitspec_primitive_font_char_if_exist:n {p,TF,T,F}
{
etex_iffontchar:D l_fontspec_font `#1 scan_stop:
prg_return_true:
else:
prg_return_false:
fi:
}
cs_new:Nn __xepersian_mathsdigitspec_char_not_exist_error:n
{
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۰ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F0 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۱ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F1 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۲ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F2 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۳ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F3 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۴ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F4 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۵ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F5 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۶ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F6 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۷ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F7 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۸ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F8 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۹ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F9 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٫ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066B } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٪ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066A } }
}
with
seq_new:N l_my_xepersian_digits_seq
seq_set_split:Nnn l_my_xepersian_digits_seq { , } { 06F0 , 06F1 , 06F2 , 06F3 , 06F4 , 06F5 , 06F6 , 06F7 , 06F8 , 06F9 , 066A , 066B }
and replaced all instances of the function
__xepersian_mathsdigitspec_char_not_exist_error with:
seq_map_inline:Nn l_my_xepersian_digits_seq
{
etex_iffontchar:D l_fontspec_font "##1 scan_stop:
else:
__xepersian_mathsdigitspec_error:nxx {char-not-exist} { #2 } { ##1 }
fi:
}
Of course one can use seq_map_function to define a new function and replace
all occurrences of the function __xepersian_mathsdigitspec_char_not_exist_error
with that.
After reading the documents "The expl3 package and LaTeX3 programming" and the
"LaTeX3 Interfaces" again (but thoroughly this time) I think I have found a
solution to my question.
I replaced the following piece of code in xepersian-mathsdigitspec.sty:
prg_new_conditional:Nnn __xepersian_mathsdigitspec_primitive_font_char_if_exist:n {p,TF,T,F}
{
etex_iffontchar:D l_fontspec_font `#1 scan_stop:
prg_return_true:
else:
prg_return_false:
fi:
}
cs_new:Nn __xepersian_mathsdigitspec_char_not_exist_error:n
{
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۰ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F0 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۱ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F1 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۲ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F2 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۳ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F3 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۴ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F4 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۵ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F5 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۶ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F6 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۷ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F7 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۸ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F8 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ۹ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 06F9 } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٫ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066B } }
__xepersian_mathsdigitspec_primitive_font_char_if_exist:nF ٪ { __xepersian_mathsdigitspec_error:nxx {char-not-exist} { #1 } { 066A } }
}
with
seq_new:N l_my_xepersian_digits_seq
seq_set_split:Nnn l_my_xepersian_digits_seq { , } { 06F0 , 06F1 , 06F2 , 06F3 , 06F4 , 06F5 , 06F6 , 06F7 , 06F8 , 06F9 , 066A , 066B }
and replaced all instances of the function
__xepersian_mathsdigitspec_char_not_exist_error with:
seq_map_inline:Nn l_my_xepersian_digits_seq
{
etex_iffontchar:D l_fontspec_font "##1 scan_stop:
else:
__xepersian_mathsdigitspec_error:nxx {char-not-exist} { #2 } { ##1 }
fi:
}
Of course one can use seq_map_function to define a new function and replace
all occurrences of the function __xepersian_mathsdigitspec_char_not_exist_error
with that.
answered Dec 18 '18 at 19:51
Tisha Shusho
175
175
add a comment |
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f464856%2fhow-to-check-the-existence-of-some-characters-in-a-font-using-a-loop%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
If you just need to see if certain glyphs exist, why not just use
fonttable, as indocumentclass{article} usepackage{fullpage} usepackage{fonttable} begin{document} fonttable{cmti10} fonttable{cmsy10} end{document}– Steven B. Segletes
Dec 18 '18 at 11:52
Welcome to the site, as well. By the way, it is appropriate in your question to include a fully compiling example rather than just a code snippet or macro definition.
– Steven B. Segletes
Dec 18 '18 at 11:54
1
Thanks, Steven, the check for the existence of the characters must be done within the program. BTW, I tried too much to prepare a complete, small, and working example, but I couldn't, because I am a newbie.
– Tisha Shusho
Dec 18 '18 at 19:41