0

アラビア語の文字列と " : 100" を連結した結果のアラビア語の文字列があります。この文字列は、測定および描画が正しくありません。なんで?

public partial class Form1 : Form {
    string strIncorrectMeasure = "مەھسۇلات باھاسى" + " : " + "100";//"مەھسۇلات باھاسى : 100";
    string strCorrectMeasure = "100 : مەھسۇلات باھاسى";
    Font font = new Font("Oybab tuz", 18);

    public Form1() {
        InitializeComponent();
    }

    void button1_Click(object sender, EventArgs e) {
        var bitmap = new Bitmap(100, 100);
        var graphics = Graphics.FromImage(bitmap);
        StringFormat format = new StringFormat(StringFormatFlags.DirectionRightToLeft | StringFormatFlags.NoFontFallback | StringFormatFlags.NoClip);
        SizeF measuredIcorrectSize = graphics.MeasureString(strIncorrectMeasure, font, 0, format);
        SizeF measuredCorrectSize = graphics.MeasureString(strCorrectMeasure, font);
        MessageBox.Show(string.Format("FirstString : {0}\nSecondString: {1}", measuredIcorrectSize, measuredCorrectSize));
    }
    void Form1_Paint(object sender, PaintEventArgs e) {
        var font = new Font("Oybab tuz", 18);           
        StringFormat format = new StringFormat(StringFormatFlags.DirectionRightToLeft);
        e.Graphics.DrawString(this.strIncorrectMeasure, font, Brushes.Black, new PointF(300, 10), format);
        e.Graphics.DrawString(this.strCorrectMeasure, font, Brushes.Black, new PointF(10, 50));
    }
}

この特定のフォントが原因でこの問題が発生する可能性はありますか?

4

2 に答える 2

0

私は解決策を見つけていません。フォント自体の問題だと思います。他のフォントは正常に動作します。

于 2015-09-02T15:25:58.313 に答える