Why is the text when I run the program not the same as when I see it in scene builder? -- Javafx

89 Views Asked by At

I am trying to use a font that I downloaded and it works fine when I use it in the scene builder the text is written correctly

scene builder text

But when I run it in intellij it does not have the same output.

idea

this is the fxml code that was written by scene builder

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.shape.Line?>
<?import javafx.scene.shape.Polygon?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>

<AnchorPane fx:id="anchor" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="145.0" minWidth="706.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Muslim_Qibla.Controllers.Mushaf">
   <children>
      <Line fx:id="l" endX="580.0" layoutX="440.0" layoutY="219.0" stroke="WHITE" strokeWidth="2.0" AnchorPane.rightAnchor="419.0" AnchorPane.topAnchor="218.0" />
      <ScrollPane hbarPolicy="NEVER" layoutX="441.0" layoutY="252.0" prefHeight="613.0" prefWidth="582.0" stylesheets="@../Css_Files/c.css" vbarPolicy="ALWAYS" vmax="100.0">
        <content>
          <AnchorPane minHeight="0.0" minWidth="0.0" opacity="0.0" prefHeight="200.0" prefWidth="200.0" />
        </content>
      </ScrollPane>
      <Rectangle fx:id="ddd" arcHeight="25.0" arcWidth="25.0" fill="#080927" height="800.0" layoutX="384.0" layoutY="104.0" opacity="0.9" stroke="BLACK" strokeType="INSIDE" width="680.0" AnchorPane.rightAnchor="376.0" AnchorPane.topAnchor="104.0" />
      <Rectangle fx:id="co" arcHeight="5.0" arcWidth="5.0" fill="#232323" opacity="0.5" pickOnBounds="true" stroke="BLACK" strokeType="INSIDE" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
      <ImageView fx:id="imageView" fitHeight="1024.0" fitWidth="1440.0" opacity="0.96" pickOnBounds="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
         <image>
            <Image url="@../Files/Mus'haf.png" />
         </image>
      </ImageView>
      <Rectangle arcHeight="30.0" arcWidth="30.0" fill="WHITE" height="40.0" layoutX="219.1999969482422" layoutY="70.4000015258789" pickOnBounds="true" stroke="#dfdbe1" strokeType="INSIDE" width="450.0" AnchorPane.leftAnchor="219.1999969482422" AnchorPane.topAnchor="70.4000015258789" />
      <ImageView fitHeight="20.0" fitWidth="20.0" layoutX="683.2000122070312" layoutY="80.4000015258789" AnchorPane.leftAnchor="633.2000122070312" AnchorPane.topAnchor="80.4000015258789">
         <image>
            <Image url="@../Files/search.png" />
         </image>
      </ImageView>
      <TextField fx:id="textField" alignment="TOP_RIGHT" layoutX="259.20001220703125" layoutY="50.400001525878906" prefHeight="14.0" prefWidth="416.0" promptText="ابحث" stylesheets="@../Css_Files/f.css" AnchorPane.leftAnchor="209.20001220703125" AnchorPane.topAnchor="50.400001525878906">
         <font>
            <Font name="kfgqpc_hafs_uthmanic_script Regular" size="24.0" />
         </font>
      </TextField>
      <Rectangle arcHeight="30.0" arcWidth="30.0" fill="#7e2092" height="40.0" layoutX="532.0" layoutY="126.4000015258789" opacity="0.8" stroke="BLACK" strokeType="INSIDE" width="200.0" AnchorPane.leftAnchor="532.0" AnchorPane.topAnchor="126.4000015258789" />
      <Text fx:id="surah" boundsType="VISUAL" fill="WHITE" layoutX="599.1599731445312" layoutY="146.39999389648438" smooth="false" strokeLineCap="ROUND" strokeType="OUTSIDE" strokeWidth="0.0" text="الكهف" textAlignment="CENTER" textOrigin="CENTER" AnchorPane.leftAnchor="601.3199732303619" AnchorPane.topAnchor="138.65999364852905">
         <font>
            <Font name="Tajawal" size="24.0" />
         </font>
      </Text>
      <Text fx:id="surah2" boundsType="VISUAL" fill="WHITE" layoutX="737.0" layoutY="146.39999389648438" smooth="false" strokeLineCap="ROUND" strokeType="OUTSIDE" strokeWidth="0.0" text="سورة" textAlignment="CENTER" textOrigin="CENTER" AnchorPane.leftAnchor="737.0" AnchorPane.topAnchor="138.4">
         <font>
            <Font name="Tajawal-Medium" size="32.0" />
         </font>
      </Text>
      <Button fx:id="m1" layoutX="532.0" layoutY="126.4000015258789" mnemonicParsing="false" onAction="#trying2" opacity="0.0" prefHeight="27.0" prefWidth="179.0" textFill="#7e2092" AnchorPane.leftAnchor="532.0" AnchorPane.topAnchor="126.4000015258789" />
      <Rectangle arcHeight="30.0" arcWidth="30.0" fill="#7e2092" height="40.0" layoutX="219.1999969482422" layoutY="126.4000015258789" opacity="0.8" stroke="BLACK" strokeType="INSIDE" width="200.0" AnchorPane.leftAnchor="219.1999969482422" AnchorPane.topAnchor="126.4000015258789" />
      <Text fx:id="surah1" boundsType="VISUAL" fill="WHITE" layoutX="249.1999969482422" layoutY="146.39999389648438" smooth="false" strokeLineCap="ROUND" strokeType="OUTSIDE" strokeWidth="0.0" text="الخامس عشر" textAlignment="CENTER" textOrigin="CENTER" AnchorPane.leftAnchor="246.96799683570862" AnchorPane.topAnchor="135.64799404144287">
         <font>
            <Font name="Tajawal" size="24.0" />
         </font>
      </Text>
      <Text fx:id="surah21" boundsType="VISUAL" fill="WHITE" layoutX="425.0" layoutY="136.0" smooth="false" strokeLineCap="ROUND" strokeType="OUTSIDE" strokeWidth="0.0" text="الجزء" textAlignment="CENTER" textOrigin="CENTER" AnchorPane.leftAnchor="425.0" AnchorPane.topAnchor="136.0">
         <font>
            <Font name="Tajawal-Medium" size="32.0" />
         </font>
      </Text>
      <Button fx:id="m" layoutX="219.1999969482422" layoutY="126.4000015258789" mnemonicParsing="false" onAction="#trying" opacity="0.0" prefHeight="27.0" prefWidth="179.0" textFill="#7e2092" AnchorPane.leftAnchor="219.1999969482422" AnchorPane.topAnchor="126.4000015258789" />
      <Rectangle fx:id="hhh" arcHeight="30.0" arcWidth="30.0" fill="#f3f3f3" height="761.0" layoutX="219.0" layoutY="187.0" opacity="0.9" stroke="BLACK" strokeType="INSIDE" width="951.0" AnchorPane.bottomAnchor="75.0" AnchorPane.leftAnchor="219.0" AnchorPane.rightAnchor="269.79999999999995" AnchorPane.topAnchor="187.0" />
      <Rectangle arcHeight="8.0" arcWidth="8.0" fill="#d1a476" height="100.0" layoutX="1069.0" layoutY="175.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" width="40.0" AnchorPane.rightAnchor="331.0" AnchorPane.topAnchor="175.0" />
      <Polygon fill="#e0dbe3" layoutX="1088.800048828125" layoutY="272.20001220703125" points="-20.5999755859375, 4.79998779296875, 20.4000244140625, 4.79998779296875, 0.0, -20.20001220703125" stroke="#e0dbe3" strokeType="INSIDE" strokeWidth="0.0" AnchorPane.rightAnchor="330.7999267578125" AnchorPane.topAnchor="252.0" />
      <Rectangle arcHeight="30.0" arcWidth="30.0" fill="#7e2092" height="40.0" layoutX="1195.0" layoutY="186.0" opacity="0.8" stroke="BLACK" strokeType="INSIDE" width="200.0" AnchorPane.rightAnchor="45.0" AnchorPane.topAnchor="186.0" />
      <Text fx:id="surah22" boundsType="VISUAL" fill="WHITE" layoutX="1240.719970703125" layoutY="206.0" smooth="false" strokeLineCap="ROUND" strokeType="OUTSIDE" strokeWidth="0.0" text="حفظ علامة" textAlignment="CENTER" textOrigin="CENTER" AnchorPane.rightAnchor="90.89602780342102" AnchorPane.topAnchor="198.23600006103516">
         <font>
            <Font name="Tajawal" size="24.0" />
         </font>
      </Text>
      <Button fx:id="m11" layoutX="1195.0" layoutY="186.0" mnemonicParsing="false" onAction="#trying" opacity="0.0" prefHeight="27.0" prefWidth="179.0" textFill="#7e2092" AnchorPane.rightAnchor="65.80000000000001" AnchorPane.topAnchor="186.0" />
      <Rectangle arcHeight="30.0" arcWidth="30.0" fill="#7e2092" height="40.0" layoutX="1195.199951171875" layoutY="247.1999969482422" opacity="0.8" stroke="BLACK" strokeType="INSIDE" width="200.0" AnchorPane.rightAnchor="44.800048828125" AnchorPane.topAnchor="247.1999969482422" />
      <Text fx:id="surah221" boundsType="VISUAL" fill="WHITE" layoutX="1262.3599853515625" layoutY="267.20001220703125" smooth="false" strokeLineCap="ROUND" strokeType="OUTSIDE" strokeWidth="0.0" text="علامات" textAlignment="CENTER" textOrigin="CENTER" AnchorPane.rightAnchor="108.44801688194275" AnchorPane.topAnchor="259.4600119590759">
         <font>
            <Font name="Tajawal" size="24.0" />
         </font>
      </Text>
      <Button fx:id="m111" layoutX="1195.199951171875" layoutY="252.0" mnemonicParsing="false" onAction="#trying" opacity="0.0" prefHeight="27.0" prefWidth="179.0" textFill="#7e2092" AnchorPane.rightAnchor="60.0" AnchorPane.topAnchor="252.0" />
      <Rectangle arcHeight="30.0" arcWidth="30.0" fill="#7e2092" height="50.0" layoutX="640.7999877929688" layoutY="956.0" opacity="0.8" stroke="BLACK" strokeType="INSIDE" width="158.0" AnchorPane.bottomAnchor="18.0" />
      <Text fx:id="surah2211" boundsType="VISUAL" fill="WHITE" layoutX="696.1437377929688" layoutY="981.0" smooth="false" strokeLineCap="ROUND" strokeType="OUTSIDE" strokeWidth="0.0" text="۳۰۲" textAlignment="CENTER" textOrigin="CENTER" AnchorPane.bottomAnchor="31.796875">
         <font>
            <Font name="Tajawal" size="32.0" />
         </font>
      </Text>
      <Button fx:id="m1111" layoutX="645.7999877929688" layoutY="960.1937255859375" mnemonicParsing="false" onAction="#trying" opacity="0.0" prefHeight="43.0" prefWidth="147.0" textFill="#7e2092" AnchorPane.bottomAnchor="20.606274414062497" />
      <Text fx:id="surah23" boundsType="VISUAL" fill="WHITE" layoutX="1028.0" layoutY="40.0" smooth="false" strokeLineCap="ROUND" strokeType="OUTSIDE" strokeWidth="0.0" text="القرآن الكريم" textAlignment="CENTER" textOrigin="TOP" AnchorPane.rightAnchor="143.40625" AnchorPane.topAnchor="40.0">
         <font>
            <Font name="kfgqpc_hafs_uthmanic_script Regular" size="64.0" />
         </font>
      </Text>
      <ImageView fitHeight="64.0" fitWidth="64.0" layoutX="1334.25" layoutY="46.0" pickOnBounds="true" preserveRatio="true" AnchorPane.rightAnchor="41.75" AnchorPane.topAnchor="46.0">
         <image>
            <Image url="@../Files/menu.png" />
         </image>
      </ImageView>
      <Button fx:id="m2" layoutX="1332.25" layoutY="50.0" mnemonicParsing="false" onAction="#trying" opacity="0.0" prefHeight="50.0" prefWidth="67.0" textFill="#7e2092" AnchorPane.rightAnchor="40.55" AnchorPane.topAnchor="50.0" />
   </children>
</AnchorPane>

I updated scene builder to version 21 and then updated java and javafx version to the latest one and even changed it to openjdk version 21 and javafx version 21, so it can be the same as the one in scnene builder and I tried to look if the encoding is correct but I didn't find anything that was wrong

and I am running it on windows 11 and this the font I am using https://fonts.qurancomplex.gov.sa/wp02/wp-content/uploads/2020/12/UthmanicHafs1_Ver13.zip https://fonts.google.com/specimen/Tajawal

0

There are 0 best solutions below