Altering text appearance in a webview

I have implemented this code in my web view.

@font-face {
  font-family: IRANSans;
  src: url("\file:///android_asset/fonts/IRANSansWeb.ttf\")
}

body {
  text-align: justify;
  direction: rtl;
  font-family: IRANSans;
}

img {
  max-width: 100%;
  height: auto;
}

figure {
  max-width: 100%;
  height: auto;
}

iframe {
  width: 100%;
}

Everything seems to be working correctly with this code except for the font family.

Although the text is justified and right-to-left oriented, the font is not displaying as desired. I have placed my ttf file in assets > fonts

Answer ā„–1

Instead of setting the link to the font that way, have you considered how the CSS is loaded in your HTML? It should not be like: file:///android_asset/css/someCSSFile.css

It seems like you linked it as: css/someCSSFile.css.

Try linking to the font using this path: fonts/IRANSansWeb.ttf

@font-face {
font-family: IRANSans;
  src: url("fonts/IRANSansWeb.ttf")
}

If that doesn't work, could you provide a screenshot showing the structure of your files?

Answer ā„–2

Ensure that your font file is correctly placed in the designated path, which is app/src/main/assets/fonts

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The Slick carousel code downloaded from their official website is malfunctioning

I found this code on slick's website, but it's not working for me. Can anyone spot what I might be missing? http://codepen.io/anon/pen/pyEddO <html> <head> <title>My Awesome New Website</title> <link rel="styles ...

Trouble in Paradise: Woocommerce Product Grid in Disarray

Currently working on a WordPress WooCommerce website and encountering an issue with the product listing. Despite trying various plugins and CSS adjustments, I am unable to correct the positioning problem. Strangely, everything seems to be functioning prope ...

Discover the best practices for integrating media queries using Radium within Material UI components

Having trouble applying a breakpoint to the Material UI component, Raised button. I have managed to make it work for regular divs, but not for the Material UI component. I attempted wrapping the button inside Radium import RaisedButton from 'materia ...

Why does the last-of-type selector work, but the first-of-type doesn't seem to?

The SCSS code snippet below is causing me some confusion: li { &.menu-item-type-custom { margin-bottom: 10px; a { // } &:last-of-type { margin-bottom: 40px; } &:first-of-type { margin-top: 40px; ...

How to Create JSON Array from MySQL Data Using PHP

For my Android app, I am receiving a JSON response from a PHP file in the following format: [{"countryname":"India","flag":"http:\/\/india.in\/india.png"}] I would like to convert it into this format. Can you provide some guidance or sugge ...

What is the best way to center a parent container vertically?

I currently have a main grid with grid items that are also containers, set as inline-sized containers to allow for different internal layouts based on their width. How can I horizontally align the main grid in the center once it exceeds a certain width? A ...

Remove the image by clicking on the "X" icon located on the top right corner of the image

One of my tasks involves deleting an image by clicking on the "X" mark located at the top right corner of the image. To achieve this, I referred to this CSS fiddle http://jsfiddle.net/yHNEv/. Sample HTML code: <div class="img-wrap"> <span ng-c ...

There was a problem encountered when attempting to start the TOR browser using Selenium WebDriver

I am currently utilizing Selenium 2.53.0 Java, Tor 6.0.4, and Firefox 43. When trying to run Tor with Firefox using the profile.default archive, I encountered some issues. I loaded the Firefoxprofile() and Firefoxbinary() with firefox.exe. Although Tor lau ...

The contents on the table are surpassing the card

Hello, I am encountering an issue with the table contents exceeding in size. You can see a screenshot of the problem https://i.sstatic.net/YDYoP.png Interestingly, when I un-collapse the sidebar, the view is perfectly fine. Here is a screenshot for refere ...

Attempting to invoke a function in the primary class activity while maintaining the identical parameters in the secondary class activity (developing in Android Studio)

Almost done with my app project, but Iā€™m stuck on one final detail. The app consists of 2 activities: one with category buttons and the other displaying information based on the selected button. For example, clicking the Fast Food button takes you to th ...

Why does Float.toString(value) have such an unpredictable rounding point?

While running the code Float.toString(68.1992069267325), I anticipated Java to output 68.19921, but was surprised to see that it returned 68.1992 instead. Upon further examination, it became apparent that the rounding point is somewhat subjective rather ...

Spring MVC: The priority of parameters when returning ModelAndView

I've recently started working with Spring and I'm looking to deepen my understanding of the MVC framework. Let's take a look at the following jsp: <%@ page language="java" contentType="text/html; charset=UTF-8" pag ...

What is the best way to line up two forms side by side?

Looking to create a login view for a webpage with two forms (one for registration and one for login) aligned side by side. Initially attempted using a table, then tried using bootstrap form groups (rows and cols) without success. Finally, aligned them in t ...

Calculating the average of 16 image byte arrays on an Android platform using Java

I have an android app that captures multiple images in a row. After taking a picture using takePicture(), I convert the byte array into a PNG format using BitmapFactory. My ultimate goal is to find the average of 16 images. To speed up the process, I am co ...

Adjust the parent div's background when hovering over it

Here is the code snippet I am working with: <div class="thumb_image_holder_orange"> <img src="http://dummyimage.com/114x64/000/fff.png" /> </div> I want to change the background of the div when hovering over the image, rather than j ...

The Picasso library can be used to load a Bitmap or byte[] into an ImageView

I'm trying to figure out how to load an image from a byte or bitmap into an ImageView using the Picasso library. This is what I have attempted: ImageView imageView = row.FindViewById<ImageView>(Resource.Id.CategoryImageView); Bitmap decoded ...

Smoothly scroll through divs using JQuery

Let me share an issue I'm facing. I have implemented smoothDivScrolling on my webpage. The problem is that the scrollable area containing all the items to be scrolled always ends up being larger than the actual content. When I reach the last item i ...

The solution for the fixed-top navbar issue in Bootstrap is not resolved with padding-top

My navigation bar is covering up my content. I've tried adding padding-top and ensuring that the custom.css file loads after the bootstrap css, but it's still not working. In my Django project, I'm certain that the custom.css file is being l ...

Combine values from a JSON string using a line break

I'm having an issue with my JSON array where each element is not printing on a new line as intended. I attempted to use '/n' and space characters for this purpose but it's not working correctly. String json = null; // Splitting the coo ...

The Dilemma of Gridview in Android Version 1.5

In my application, I implemented a grid view. When running the app on Version 1.6 or newer, everything works fine. However, there is an issue with displaying the grid view in 1.5. The error message and exception that keep appearing are: <RelativeLayo ...