हमारा सुझाव है कि 27 मार्च, 2025 से AOSP को बनाने और उसमें योगदान देने के लिए, aosp-main
के बजाय android-latest-release
का इस्तेमाल करें. ज़्यादा जानकारी के लिए, AOSP में हुए बदलाव लेख पढ़ें.
पसंद के मुताबिक फ़ॉन्ट जोड़ना
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
अब फ़ॉन्ट बदलने के लिए, रनटाइम रिसॉर्स ओवरले (आरआरओ) का इस्तेमाल किया जा सकता है. फ़ॉन्ट पैकेज बनाने के लिए पसंद के मुताबिक फ़ॉन्ट जोड़कर, थीम में फ़ॉन्ट का इस्तेमाल किया जा सकता है. साथ ही, पसंद के मुताबिक बदलाव करने के लिए आरआरओ का इस्तेमाल किया जा सकता है.
ये टास्क पूरे करें:
custom-fonts.zip में, फ़ाइल के स्ट्रक्चर और फ़ाइलों के सैंपल दिए गए हैं.
अपने इस्तेमाल के लिए, इस फ़ाइल को डाउनलोड करें और फिर उसे लोकल स्टोरेज में निकालें.
फ़ॉन्ट पैकेज बनाना
फ़ॉन्ट पैकेज बनाने के लिए:
vendor
पार्टीशन में मौजूद फ़ॉन्ट पैकेज में, सभी फ़ॉन्ट ttf
फ़ाइलें जोड़ें. उदाहरण के लिए:
vendor/[oem]/fonts/[oem]-sans/
- फ़ॉन्ट पैकेज के लिए
Android.mk
फ़ाइल बनाएं. उदाहरण के लिए:
vendor/[oem]/fonts/[oem]-[fontname]/Android.mk
- पक्का करें कि मॉड्यूल,
etc
फ़ोल्डर में product
पार्टीशन में इंस्टॉल किया जाएगा. ऐसा करने के लिए, पुष्टि करें कि मॉड्यूल में ये फ़्लैग मौजूद हों:
LOCAL_MODULE_CLASS := ETC
LOCAL_PRODUCT_MODULE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/fonts
ऊपर दिए गए सैंपल कोड में, फ़ॉन्ट पैकेज मॉड्यूल की पूरी जानकारी दी गई है.
- फ़ॉन्ट पैकेज के लिए
fonts.mk
नाम की फ़ाइल बनाएं. इसके बाद, PRODUCT_PACKAGES
में फ़ॉन्ट
ttf
फ़ाइलें जोड़ें. उदाहरण के लिए:
vendor/[oem]/fonts/[oem]-[fontname]/fonts.mk
उदाहरण के लिए:
PRODUCT_PACKAGES := \
[font name].ttf \
डिवाइस ओवरले पैकेज बनाना
- बिल्ड में जोड़ने के लिए,
fonts_customization.xml
नाम का मॉड्यूल बनाएं.
यह मॉड्यूल, fonts_customization.xml
फ़ाइल पर ले जाता है, जिसमें फ़ॉन्ट फ़ैमिली होती हैं. साथ ही, यह सभी फ़ॉन्ट पैकेज की मेक फ़ाइलों को कॉल करता है. उदाहरण के लिए:
vendor/[oem]/[device]_overlay/fonts/Android.mk
- फ़ॉन्ट फ़ैमिली बनाएं:
vendor/[oem]/[device]_overlay/fonts/fonts_customization.xml
फ़ाइल का रूट लेवल, fonts-modification
टैग होना चाहिए. इस एलिमेंट में, हर फ़ॉन्ट पैकेज के लिए फ़ॉन्ट फ़ैमिली जोड़ें. इसके अलावा, हर फ़ॉन्ट फ़ैमिली में
customizationType="new-named-family"
जोड़ें और पक्का करें कि हर फ़ॉन्ट फ़ैमिली में name
एट्रिब्यूट हो. इस नाम का इस्तेमाल बाद में,
फ़ॉन्ट फ़ैमिली को ऐक्सेस करने के लिए किया जाता है. इस फ़ाइल को Android.mk
में पहले से तय किए गए fonts_customizations.xml
मॉड्यूल में जोड़ना होगा.
ऊपर दिए गए सैंपल में, मान्य fonts_customization.xml
फ़ाइल शामिल है.
fonts.mk
बनाएं. उदाहरण के लिए:
vendor/[oem]/[device]_overlay/fonts/fonts.mk
PRODUCT_PACKAGES
फ़्लैग के नीचे fonts_customization.xml
जोड़ें.
- पहले से बनाए गए हर फ़ॉन्ट पैकेज को कॉल करें.
$(call inherit-product-if-exists, vendor/[oem]/fonts/[oem]-[fontname]/fonts.mk)
PRODUCT_PACKAGES
में जाकर, फ़ॉन्ट मॉड्यूल को बिल्ड में जोड़ें. इसके बाद, फिर से बिल्ड करें.
फ़ॉन्ट, सिस्टम पर इंस्टॉल हो जाएंगे.
- पुष्टि करें कि
ttf
फ़ॉन्ट फ़ाइलें, डिवाइस पर /product/fonts
फ़ोल्डर में हों.
- पुष्टि करें कि डिवाइस पर
fonts_customization.xml
, /product/etc/
में है.
नई सिस्टम फ़ॉन्ट फ़ैमिली का इस्तेमाल करना
सिस्टम की नई फ़ॉन्ट फ़ैमिली का इस्तेमाल करने के लिए:
<style name="customstyle">
<item name="android:fontFamily">customfontfamily</item>
</style>
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-08-10 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-08-10 (UTC) को अपडेट किया गया."],[],[],null,["# Add custom fonts\n\nYou can now use runtime resource overlays (RROs) to change fonts. By adding custom\nfonts to make a font package, you can use fonts in themes and use RROs to apply the\ncustomizations.\n\nComplete these tasks:\n\n- [Make a font package](/docs/automotive/hmi/car_ui/fonts#make)\n- [Create a device overlay package](/docs/automotive/hmi/car_ui/fonts#create)\n- [Use the added system fonts family](/docs/automotive/hmi/car_ui/fonts#use)\n\nA sample file structure and sample files are provided in\n[custom-fonts.zip](/static/docs/automotive/hmi/car_ui/custom-fonts.zip).\nDownload and then extract this file locally for your own use.\n\nMake a font package\n-------------------\n\nTo make a font package:\n\n1. Add all the font `ttf` files to the font package in the `vendor` partition. For example:\n\n `vendor/[oem]/fonts/[oem]-sans/`\n2. Create the `Android.mk` file for the font package. For example:\n\n `vendor/[oem]/fonts/[oem]-[fontname]/Android.mk`\n3. Make sure the module will be installed in the `product` partition in the `etc` folder. To do so, confirm the module has the following flags: \n\n ```makefile\n LOCAL_MODULE_CLASS := ETC\n LOCAL_PRODUCT_MODULE := true\n LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/fonts\n ```\n\n The sample code provided above illustrates a complete definition of a font package module.\n4. Create a file named `fonts.mk` for the font package and then add the font `ttf` files to `PRODUCT_PACKAGES`. For example:\n\n `vendor/[oem]/fonts/[oem]-[fontname]/fonts.mk`\n\n For example: \n\n ```objective-c\n PRODUCT_PACKAGES := \\\n [font name].ttf \\\n ```\n\nCreate a device overlay package\n-------------------------------\n\n1. Make a module called `fonts_customization.xml` to be added to the build. This module points to the `fonts_customization.xml` file that contains the font families and calls the make files of all the font packages. For example:\n\n `vendor/[oem]/[device]_overlay/fonts/Android.mk`\n2. Create the font families: `vendor/[oem]/[device]_overlay/fonts/fonts_customization.xml`\n\n The root level of the file must be a `fonts-modification` tag. Add\n font families for each of the font packages under this element. In addition, add\n `customizationType=\"new-named-family\"` to every font family, and make\n sure each has a `name` attribute. This name is used later to access the\n font family. This file must be added to the `fonts_customizations.xml`\n module defined previously in `Android.mk`.\n\n The sample provided above contains a valid `fonts_customization.xml` file.\n3. Create `fonts.mk`. For example:\n\n `vendor/[oem]/[device]_overlay/fonts/fonts.mk`\n4. Add `fonts_customization.xml` under the `PRODUCT_PACKAGES` flag.\n5. Call into each of the previously created font packages.\n `$(call inherit-product-if-exists, vendor/[oem]/fonts/[oem]-[fontname]/fonts.mk)`\n\n6. Add the font module to the build under `PRODUCT_PACKAGES` and then rebuild. The fonts will be installed on the system.\n7. Verify that the `ttf` fonts files are in the `/product/fonts` folder on the device.\n8. Verify that `fonts_customization.xml` is in `/product/etc/` on the device.\n\nUse the new system fonts family\n-------------------------------\n\nTo use the new system fonts family: \n\n```text\n\u003cstyle name=\"customstyle\"\u003e\n \u003citem name=\"android:fontFamily\"\u003ecustomfontfamily\u003c/item\u003e\n\u003c/style\u003e\n```"]]