Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [HTML][CSS] Brak własnej czcionki
stefik4
post 22.05.2013, 08:40:21
Post #1





Grupa: Zarejestrowani
Postów: 176
Pomógł: 1
Dołączył: 18.11.2007

Ostrzeżenie: (0%)
-----


Witam na swojej stronie chciałem wrzucić niestandardową czcionkę. Wrzuciłem ją na serwer w odpowiedni katalo, a w kodzie umieściłem cos takiego:

  1. @font-face {
  2. font-family: 'scl';
  3. src: url('img/SwitzerlandCondensedLight.TTF');
  4. font-weight: normal;
  5. font-style: normal;
  6. }


Czcionka wyświetlona jest tylko w Mozilli FF:


Zaś np w chromie dzieje się takie cos:


W miejsce tej czcionki wskakuje standardowa. Jest na to jakaś rada?
Go to the top of the page
+Quote Post
Damonsson
post 22.05.2013, 08:44:50
Post #2





Grupa: Zarejestrowani
Postów: 2 355
Pomógł: 533
Dołączył: 15.01.2010
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


src: url('img/SwitzerlandCondensedLight.TTF') format('truetype');

A tak?
Go to the top of the page
+Quote Post
Hyth
post 22.05.2013, 08:51:15
Post #3





Grupa: Zarejestrowani
Postów: 23
Pomógł: 2
Dołączył: 21.05.2013

Ostrzeżenie: (0%)
-----


A dlaczego dodajesz font-face tylko w formacie .ttf? A co z resztą?

Tutaj masz link jak tego używać:

http://css-tricks.com/snippets/css/using-font-face/

Ten post edytował Hyth 22.05.2013, 08:52:06
Go to the top of the page
+Quote Post
stefik4
post 22.05.2013, 08:56:31
Post #4





Grupa: Zarejestrowani
Postów: 176
Pomógł: 1
Dołączył: 18.11.2007

Ostrzeżenie: (0%)
-----


Przeczytałem właśnie to an stronie: http://www.webnote.pl/font-face-wlasna-czc...ternetowej.html

I zastosowłem tak:
  1. @font-face {
  2. font-family: 'scl';
  3. src: url('img/SwitzerlandCondensedLight.eot');
  4. src: url('img/SwitzerlandCondensedLight.TTF') format('truetype'),
  5. url('img/SwitzerlandCondensedLight.SVG#svgFontName') format('svg');
  6. font-weight: normal;
  7. font-style: normal;
  8. }


Lecz nadal to samo ;/
Go to the top of the page
+Quote Post
Hyth
post 22.05.2013, 09:00:18
Post #5





Grupa: Zarejestrowani
Postów: 23
Pomógł: 2
Dołączył: 21.05.2013

Ostrzeżenie: (0%)
-----


A jesteś pewien, że ścieżka do czcionki jest prawidłowa? Pokombinuj z tym, bo może tu być błąd. Ewentualnie podrzuć link do strony.
Go to the top of the page
+Quote Post
stefik4
post 22.05.2013, 09:08:38
Post #6





Grupa: Zarejestrowani
Postów: 176
Pomógł: 1
Dołączył: 18.11.2007

Ostrzeżenie: (0%)
-----


Postanowiłem to trochę uporządkowac i zrobiłem katalog fonts w kalatolu img i mam taki kod:

  1. @font-face {
  2. font-family: 'scl';
  3. src: url('img/fonts/SwitzerlandCondensedLight.eot');
  4. src: url('img/fonts/SwitzerlandCondensedLight.woff') format('woff'),
  5. url('img/fonts/SwitzerlandCondensedLight.ttf') format('truetype'),
  6. url('img/fonts/SwitzerlandCondensedLight.svg#svgFontName') format('svg');
  7. font-weight: normal;
  8. font-style: normal;
  9. }


A tutaj zrzut tego katalogu:


PS. Dodałem jeszcze format woof bo było tam też takie coś wymienione. I po dodaniu tego woof się naprawiło smile.gif Tylko czcionka tam jest jakby mniej wygładzona:



Ale na to już chyba nie ma rady, bo każda przeglądarka pewnie inaczej interpretuje
Go to the top of the page
+Quote Post
Hyth
post 22.05.2013, 09:15:07
Post #7





Grupa: Zarejestrowani
Postów: 23
Pomógł: 2
Dołączył: 21.05.2013

Ostrzeżenie: (0%)
-----


A spróbuj dodać to na koniec i powiedz czy pomogło.


@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'scl';
url('img/fonts/SwitzerlandCondensedLight.svg#svgFontName') format('svg');
}
}
Go to the top of the page
+Quote Post
stefik4
post 22.05.2013, 09:17:32
Post #8





Grupa: Zarejestrowani
Postów: 176
Pomógł: 1
Dołączył: 18.11.2007

Ostrzeżenie: (0%)
-----


Tzn pod tym moim całym kodem CSS wkleić to co Ty tutaj podałeś ?
Go to the top of the page
+Quote Post
Hyth
post 22.05.2013, 09:19:43
Post #9





Grupa: Zarejestrowani
Postów: 23
Pomógł: 2
Dołączył: 21.05.2013

Ostrzeżenie: (0%)
-----


Zaraz za pierwszą regułą
@font-face {
blablabla
}

<TUTAJ>.
Go to the top of the page
+Quote Post
stefik4
post 22.05.2013, 09:21:04
Post #10





Grupa: Zarejestrowani
Postów: 176
Pomógł: 1
Dołączył: 18.11.2007

Ostrzeżenie: (0%)
-----


To miało wygładzić w Operze i Chromie ? Nic się nie zmieniło.
Go to the top of the page
+Quote Post
Hyth
post 22.05.2013, 09:28:11
Post #11





Grupa: Zarejestrowani
Postów: 23
Pomógł: 2
Dołączył: 21.05.2013

Ostrzeżenie: (0%)
-----


Ok jest jeszcze opcja taka.

Wywal to co podałem Ci ostatnio.

a to: url('img/fonts/SwitzerlandCondensedLight.svg#svgFontName') format('svg');

wstaw przed:

url('img/fonts/SwitzerlandCondensedLight.woff') format('woff')

Wtedy Chrome powinien pobierać właśnie 'svg', która jest specjalnie dla niego przygotowana.
Go to the top of the page
+Quote Post
stefik4
post 22.05.2013, 09:31:37
Post #12





Grupa: Zarejestrowani
Postów: 176
Pomógł: 1
Dołączył: 18.11.2007

Ostrzeżenie: (0%)
-----


  1. @font-face {
  2. font-family: 'scl';
  3. src: url('img/fonts/SwitzerlandCondensedLight.eot');
  4. src: url('img/fonts/SwitzerlandCondensedLight.svg#svgFontName') format('svg'),
  5. url('img/fonts/SwitzerlandCondensedLight.woff') format('woff'),
  6. url('img/fonts/SwitzerlandCondensedLight.ttf') format('truetype');
  7. font-weight: normal;
  8. font-style: normal;
  9. }


Nadal tak samo
Go to the top of the page
+Quote Post
Hyth
post 22.05.2013, 09:40:53
Post #13





Grupa: Zarejestrowani
Postów: 23
Pomógł: 2
Dołączył: 21.05.2013

Ostrzeżenie: (0%)
-----


Ok, dopiero teraz zauważyłem.

src: url('img/fonts/SwitzerlandCondensedLight.svg#svgFontName') format('svg'),


Przecież "svgFontName" - to musi być nazwa fonta. Zmień to, bo teraz "svg" jakby nie istnieje wcale bo jest źle wywołane.

Edit:

Ewentualnie usuń tę część po .svg
Czyli zostaw tylko:

src: url('img/fonts/SwitzerlandCondensedLight.svg') format('svg'),

Edit2:

Coś mi się z tym woff nie podoba. Po wywaleniu tego formatu, strona wygląda dobrze.

Ten post edytował Hyth 22.05.2013, 09:52:26
Go to the top of the page
+Quote Post
stefik4
post 22.05.2013, 09:55:30
Post #14





Grupa: Zarejestrowani
Postów: 176
Pomógł: 1
Dołączył: 18.11.2007

Ostrzeżenie: (0%)
-----


Po wywaleniu woffa całkiem znów sie wszystko psuje przynajmniej u mnie i na Chromie.
Go to the top of the page
+Quote Post
StrefaPi
post 22.05.2013, 10:52:44
Post #15





Grupa: Zarejestrowani
Postów: 235
Pomógł: 50
Dołączył: 2.03.2013

Ostrzeżenie: (0%)
-----


chrome (i tylko chrome pod windows inne przeglądarki na webkit już nie) jako jedna z nielicznych przeglądarek źle renderuje niektóre fonty css bo nie wykorzystuje standardowego renderera fontu z systemu tylko własny... w którym nie ma standardowo włączonego antyaliasingu...

na ten problem nie ma skutecznego rozwiązania, font zawsze będzie postrzępiony...

czasem podawane jest rozwiązanie na zasadzie, ale osobiście na Chromie pod Windows nie widze różnicy dużej:
Kod
@font-face {
    font-family: 'chunk-webfont';
    src: url('../../includes/fonts/chunk-webfont.eot');
    src: url('../../includes/fonts/chunk-webfont.eot?#iefix') format('eot'),
    url('../../includes/fonts/chunk-webfont.woff') format('woff'),
    url('../../includes/fonts/chunk-webfont.ttf') format('truetype'),
    url('../../includes/fonts/chunk-webfont.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

@media screen and (-webkit-min-device-pixel-ratio:0) {
    @font-face {
        font-family: 'chunk-webfont';
        src: url('../../includes/fonts/chunk-webfont.svg') format('svg');
    }
}


Ten post edytował StrefaPi 22.05.2013, 11:04:19


--------------------
https://studiostawki.com - studio fotograficzne i filmowe - ul. Inflancka 11, Warszawa
Go to the top of the page
+Quote Post
Hyth
post 22.05.2013, 11:51:03
Post #16





Grupa: Zarejestrowani
Postów: 23
Pomógł: 2
Dołączył: 21.05.2013

Ostrzeżenie: (0%)
-----


Ok, w tym wypadku pomogła zmiana koloru czcionki z #fff na #eee.
Różnica dalej jest, ale już nie rzuca się tak w oczy.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 13.06.2025 - 09:28