VIK*_*VIK 3 delphi unicode freepascal lazarus
freepascal中是否有任何函数通过其代码显示Unicode符号(例如U + 1D15E)?不幸的是,Chr()只能使用ANSI符号(代码小于127).
我想使用自定义符号字体中的符号,将它们直接放入源代码非常不方便(它们在Lazarus中显示为?或其他东西,因为它们在系统字体中不存在).
看看这个页面.我假设Freepascal使用UTF-16,它成为两个WideChars(见表)或UTF-8的代理对,其中它变成一个字节值序列(再次参见表格).
UTF-8:
const
HalfNoteString = UTF8String(#$F0#$9D#$85#$9E);
Run Code Online (Sandbox Code Playgroud)
UTF-16:
const
HalfNoteString = UnicodeString(#$D834#$DD5E);
Run Code Online (Sandbox Code Playgroud)
字符串类型的名称可能不同,因为我不太了解FreePascal.也许是AnsiString和WideString.
我从未使用Free Pascal,但如果我是你,我会尝试
var
s: char;
begin
s := char($222b); // Just cast a word
Run Code Online (Sandbox Code Playgroud)
或者,如果编译器真的很顽固,
var
s: char;
begin
PWord(@s)^ := $222b; // Forcibly write a word
Run Code Online (Sandbox Code Playgroud)