임의의 글꼴로 Docker에서 웹 사이트 캡처
목적 Docker에서 임의의 글꼴로 사이트 캡처 가산점 테스트 받기
캡처할 때까지 기사가 나왔지만 임의의 글씨체를 설정하기 전까지 글을 발견하지 못해 썼다.
모든 소스가 여기 있다https://github.com/frkwy/xvfb_screenshot_on_docker
이번에 사용한 글씨체와 문장.
여고생 스타일?JK Gothic L
청공문고 하목가석 고양이입니다.
사용했습니다.
글꼴 및 우선순위 확인
사용하고자 하는 글꼴의 우선순위가 열거되면 해결됩니다.
fc-list
: 글꼴 목록이 여기에 없으면 글꼴이 설치되지 않습니다.이번에는 Firefox.
fc-match -s sarif
실행할 때 쓰고 싶은 글꼴을 맨 위에 놓으면 OK.이 font입니다.conf를 만듭니다.
Dockerfile
FROM alpine:latest
COPY fonts.conf /root/.config/fontconfig/
# Please override your favorite font file path
COPY JKG-L_3.ttf /root/.local/share/fonts/
RUN apk update && apk add python3 xvfb firefox dbus && rm -rf /var/cache/apk/*
RUN python3 -m ensurepip
RUN pip3 install --upgrade pip selenium xvfbwrapper
RUN fc-cache -fv
CMD ["python3", "/host/example.py"]
font.conf
위의 Docker file에 글꼴이 이미 설치되어 있다고 가정합니다.
사용할 글꼴의 우선순위
binding="strong"
를 맨 위에 놓습니다.<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<edit name="family" mode="assign" binding="strong">
<string>JKゴシックL</string>
</edit>
</match>
</fontconfig>
실제 촬영한 캡처입니다.Reference
이 문제에 관하여(임의의 글꼴로 Docker에서 웹 사이트 캡처), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/yusukefurukawa/items/8774a2fc38799915790b텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)