4. In an acute triangle $\triangle A B C$, the three altitudes $A D, B E$, and $C F$ intersect at point $H$. Then $H D: H E: H F=(\quad)$.
(A) $a: b: c$
(B) $\cos A: \cos B: \cos C$
(C) $\frac{1}{a}: \frac{1}{b}: \frac{1}{c}$
(D) $\frac{1}{\cos A}: \frac{1}{\cos B}: \frac{1}{\cos C}$
4. D.

As shown in Figure 2, it is easy to see that
$$
\begin{array}{l}
H D: H E \\
=\cos \angle C H D: \\
\quad \cos \angle C H E \\
=\cos B: \cos A .
\end{array}
$$

Similarly,
$$
H E: H F=\cos C: \cos B \text {. }
$$

From equations (1) and (2), we get
$$
H D: H E: H F=\frac{1}{\cos A}: \frac{1}{\cos B}: \frac{1}{\cos C} .
$$