Unicode in Delphi form TRectangle TText

自闭症网瘾萝莉.ら 提交于 2019-12-05 14:09:13

The Unicode Chess Pieces can be shown in any Delphi application provided you have a fond that contains the Glyphs for the various CodePoints in Unicode representing the Chess Pieces.

Actually, it does not matter what platform or development environment you use, as long as they support Unicode and you have the right font.

You need:

  1. a means to enter these Unicode CodePoints
  2. a font representing these Unicode CodePoints as Glyphs on your target platform

To start with the last, for Microsoft Windows, these fonts work fine:

For entering these there are two approaches on Microsoft Windows:

  1. if you enable it in the registry: enter hexadecimal Unicode CodePoint numbers through Alt-codes on the keyboard
  2. copy/paste them from an application (i.e. Unicode Input: Selection from Screen) that provides them as text

For copy/paste, I often go to a web page with the correct characters using a Web Browser that supports Unicode, or search for them using the Character Map application.

To make copy/paste easier:

  • These are the white pieces: ♔♕♖♗♘♙
  • These are the black pieces: ♚♛♜♝♞♟

Example FireMonkey form with all the pieces in 1 TText in one TTRectangle:

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 480
  ClientWidth = 640
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [dkDesktop, dkiPhone, dkiPad]
  DesignerMobile = False
  DesignerWidth = 0
  DesignerHeight = 0
  DesignerDeviceName = ''
  DesignerOrientation = 0
  object Rectangle1: TRectangle
    Height = 50.000000000000000000
    Width = 80.000000000000000000
    object Text1: TText
      Color = claBlack
      Height = 50.000000000000000000
      Text = #9812#9813#9814#9815#9816#9817#9818#9819#9820#9821#9822#9823
      Width = 80.000000000000000000
    end
  end
end

Edit

I think you have a font size issue in your form file. Create a new question with the text of your form file. Two ways to do that:

  1. open Notepad, and in notepad open the .FMX file that goes with your form; copy the text to the clipboard
  2. In Delphi, right click on the form then choose "View as Text", select all the text and copy it to the clipboard, right click on your form text then select "View as Form".

Paste the code at http://pastebin.com/ or https://gist.github.com/ then post that link in a new question. After that comment here you did and I will take a look.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!